diff --git a/src/pgduckdb_ruleutils.cpp b/src/pgduckdb_ruleutils.cpp index 4622b061..d18b1f9b 100644 --- a/src/pgduckdb_ruleutils.cpp +++ b/src/pgduckdb_ruleutils.cpp @@ -248,6 +248,15 @@ pgduckdb_get_tabledef(Oid relation_oid) { continue; } + if (get_typtype(column->atttypid) == TYPTYPE_DOMAIN) { + elog(ERROR, "Domain is not supported in DuckDB"); + } else if (type_is_array(column->atttypid)) { + Oid elem_type = get_base_element_type(column->atttypid); + if (get_typtype(elem_type) == TYPTYPE_DOMAIN) { + elog(ERROR, "Domain is not supported in DuckDB"); + } + } + const char *column_name = NameStr(column->attname); const char *column_type_name = format_type_with_typemod(column->atttypid, column->atttypmod); diff --git a/test/regression/expected/temporary_tables.out b/test/regression/expected/temporary_tables.out index eaa71f90..87d160a0 100644 --- a/test/regression/expected/temporary_tables.out +++ b/test/regression/expected/temporary_tables.out @@ -472,4 +472,13 @@ SELECT * FROM ta; 3 | 3 (6 rows) +CREATE DOMAIN domainint4 int4; +CREATE TEMP TABLE domaintest(testint4 domainint4) USING duckdb; +ERROR: Domain is not supported in DuckDB +CREATE DOMAIN domain_int_array as INT[]; +CREATE TEMP TABLE domaintest(testint4_array domain_int_array) USING duckdb; +ERROR: Domain is not supported in DuckDB +CREATE TEMP TABLE domaintest(testint4_array domainint4[]) USING duckdb; +ERROR: Domain is not supported in DuckDB +DROP DOMAIN domainint4; DROP TABLE webpages, t, t_heap, t_heap2, ta, tb, tc, td; diff --git a/test/regression/sql/temporary_tables.sql b/test/regression/sql/temporary_tables.sql index e53d95c8..e11b4c6d 100644 --- a/test/regression/sql/temporary_tables.sql +++ b/test/regression/sql/temporary_tables.sql @@ -250,4 +250,11 @@ INSERT INTO ta (a) SELECT * FROM generate_series(1, 3); -- OK INSERT INTO ta (b) SELECT * FROM generate_series(1, 3); -- OK SELECT * FROM ta; +CREATE DOMAIN domainint4 int4; +CREATE TEMP TABLE domaintest(testint4 domainint4) USING duckdb; +CREATE DOMAIN domain_int_array as INT[]; +CREATE TEMP TABLE domaintest(testint4_array domain_int_array) USING duckdb; +CREATE TEMP TABLE domaintest(testint4_array domainint4[]) USING duckdb; + +DROP DOMAIN domainint4; DROP TABLE webpages, t, t_heap, t_heap2, ta, tb, tc, td;