-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: pgwire behavior for string arrays is partially incorrect #12207
Comments
There's another similar issue with this query: the |
When running a Sequelize app against the latest master code I still get this:
@jordanlewis can you take a look? |
Thanks for the report @cuongdo. Indeed @nvanbenschoten's PR didn't quite get us to the finish line for this issue. The problem with this query is the following part of the I believe we just need to add a new override for |
My last PR alone wasn't meant to solve this issue fully. I have another PR out (#12644) that will fix this. I haven't pushed an update since knz's review yet because I'm reconsidering a part of it, but I'll make sure to update it later today. |
Ah, okay. Thanks, Nathan! |
Sorry for not catching that the |
Fixes cockroachdb#12207. This change adjusts aggregate constructors take their parameter types. This is useful for when aggregate behavior needs to change depending on the input parameters. For instance, the same constructor needs to be used for `array_agg(string)` and `array_agg(name)`, but their runtime behavior needs to be different.
Fixes cockroachdb#12207. This change adjusts aggregate constructors take their parameter types. This is useful for when aggregate behavior needs to change depending on the input parameters. For instance, the same constructor needs to be used for `array_agg(string)` and `array_agg(name)`, but their runtime behavior needs to be different.
Sequelize queries various
pg_catalog
tables to assemble an array of column names, using the following query:One of the return values is the result of
ARRAY_AGG(a.attname)
, which we treat as an array of strings. We return arrays of strings as strings that look like this:{'foo','bar','baz'}
.Sequelize fails to parse the representation of this array that we send over the pg wire protocol for two separate reasons.
{foo,bar,baz}
unless a string has a,
character in it in which case it'll be{foo,"bar,",baz}
.1003
, corresponding to an array ofname
types. We report that this array is of type1009
, or an array oftext
types. If we report1009
, Sequelize actually blows up while trying to parse the returned array.It shouldn't be too hard to solve the first one. The second one is a little bit more involved - we'll need to make a
Datum
type for column name literal values, as well as a corresponding type for arrays of those. Then we'll need to change the relevant column definitions inpg_catalog
to use this new type.The text was updated successfully, but these errors were encountered: