conn: 2
query:
select b.oid, b.typarray
from pg_catalog.pg_type a
left join pg_catalog.pg_type b on b.oid = a.typelem
where a.typcategory = 'A'
group by b.oid, b.typarray
order by b.oid
params: []
types: []
-----
conn: 2
query: SELECT $1;
params: [ [ "text", "array" ] ]
types: [ 25 ]
-----
first: Result(1) [ { "?column?": "text,array" } ]
=====
conn: 2
query: SELECT $1;
params: [ [ "text", "array" ] ]
types: [ 1009 ]
-----
second: Result(1) [ { "?column?": [ "text", "array" ] } ]
=====
It seems the first query failed to utilize type oids from the initial pg_type query, thus treating the array as 25 TEXT.
The second (and so on) query does set the correct type to 1009 TEXT[].
The bug occurs both in deno and node, using latest postgres.js 3.4.3
Maybe there's a bug for the type query thing, or maybe we should always default type of arrays to 1009 TEXT[]?
When using
sql.array()
immediately after connection is made, the inferred data type if wrong.Code above gives following output:
It seems the first query failed to utilize type oids from the initial
pg_type
query, thus treating the array as25 TEXT
. The second (and so on) query does set the correct type to1009 TEXT[]
.The bug occurs both in deno and node, using latest postgres.js 3.4.3
Maybe there's a bug for the type query thing, or maybe we should always default type of arrays to
1009 TEXT[]
?