TestArrayToStringThreeArg covers the PostgreSQL 3-arg array_to_string(arr, sep, nullstr) form. DuckDB's builtin only has the 2-arg arity, so initPgCatalog shadows it with a dual-arity macro; both arities must keep working.
(t *testing.T)
| 9 | // nullstr) form. DuckDB's builtin only has the 2-arg arity, so initPgCatalog |
| 10 | // shadows it with a dual-arity macro; both arities must keep working. |
| 11 | func TestArrayToStringThreeArg(t *testing.T) { |
| 12 | runMacroCases(t, []macroCase{ |
| 13 | // 3-arg: NULL elements rendered as nullstr |
| 14 | {"array_to_string_3arg_nullstr", `SELECT array_to_string(ARRAY['a', NULL, 'c'], ',', '*')`, "a,*,c", false}, |
| 15 | // 3-arg with nullstr=NULL degrades to 2-arg semantics (NULLs omitted) |
| 16 | {"array_to_string_3arg_null_nullstr", `SELECT array_to_string(ARRAY['a', NULL, 'c'], ',', NULL)`, "a,c", false}, |
| 17 | // 2-arg must keep the builtin behavior: NULLs omitted, matching PG |
| 18 | {"array_to_string_2arg_skips_nulls", `SELECT array_to_string(ARRAY['a', NULL, 'c'], ',')`, "a,c", false}, |
| 19 | // non-text arrays work via ::VARCHAR in both arities |
| 20 | {"array_to_string_2arg_ints", `SELECT array_to_string(ARRAY[1, NULL, 2], ',')`, "1,2", false}, |
| 21 | {"array_to_string_3arg_ints", `SELECT array_to_string(ARRAY[1, NULL, 2], ',', '0')`, "1,0,2", false}, |
| 22 | }) |
| 23 | } |
| 24 | |
| 25 | // TestPgCatalogStubRelations covers pg_catalog relations that DuckDB lacks |
| 26 | // entirely but real clients/BI tools query. pg_user is derived from pg_roles |
nothing calls this directly
no test coverage detected