diff --git a/src/pgsql/pgsql-schema.lisp b/src/pgsql/pgsql-schema.lisp index 0b98459..b2d7a27 100644 --- a/src/pgsql/pgsql-schema.lisp +++ b/src/pgsql/pgsql-schema.lisp @@ -185,7 +185,8 @@ :do (let* ((schema (maybe-add-schema catalog schema-name)) (table (maybe-add-table schema table-name :oid table-oid)) - (field (make-column :name name + (field (make-column :table table + :name name :type-name type :type-mod typmod :nullable (not notnull) diff --git a/src/sources/pgsql/pgsql-cast-rules.lisp b/src/sources/pgsql/pgsql-cast-rules.lisp index ea1ef04..d7b003c 100644 --- a/src/sources/pgsql/pgsql-cast-rules.lisp +++ b/src/sources/pgsql/pgsql-cast-rules.lisp @@ -26,7 +26,8 @@ (defmethod cast ((field column) &key &allow-other-keys) "Return the PostgreSQL type definition from the given PostgreSQL column definition" - (with-slots (pgloader.catalog::name + (with-slots (pgloader.catalog::table + pgloader.catalog::name pgloader.catalog::type-name pgloader.catalog::type-mod pgloader.catalog::nullable @@ -40,7 +41,7 @@ (when (and (stringp (column-default field)) (search "identity" (column-default field))) :auto-increment))) - (pgcol (apply-casting-rules nil + (pgcol (apply-casting-rules (table-source-name pgloader.catalog::table) pgloader.catalog::name pgloader.catalog::type-name ctype diff --git a/src/utils/catalog.lisp b/src/utils/catalog.lisp index baca81a..8b0cd62 100644 --- a/src/utils/catalog.lisp +++ b/src/utils/catalog.lisp @@ -71,7 +71,7 @@ ;;; produce, so that we know how to CREATE TABLEs in PostgreSQL whatever the ;;; source is. ;;; -(defstruct column name type-name type-mod nullable default comment +(defstruct column table name type-name type-mod nullable default comment transform extra (transform-default t)) ;;; diff --git a/test/citus/company.load b/test/citus/company.load index ef4af21..c2f7ad0 100644 --- a/test/citus/company.load +++ b/test/citus/company.load @@ -4,6 +4,8 @@ load database with include drop, reset no sequences + cast column impressions.seen_at to "timestamp with time zone" + distribute companies using id -- distribute campaigns using company_id -- distribute ads using company_id from campaigns