-
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: Sequelize fixes #13484
sql: Sequelize fixes #13484
Conversation
Reviewed 2 of 2 files at r1. pkg/sql/pg_catalog.go, line 817 at r2 (raw file):
Nice idea! I... don't think that we should merge this, though. It may fix things for Sequelize, but int2vectors in Postgres are arrays - and because they are arrays, there's a lot of external code that uses them as arrays. I don't think we should do a quick fix for Sequelize and break a ton of other postgres compatible code. For example, here's code within PGJDBC that assumes that indkey is an array: https://github.com/pgjdbc/pgjdbc/search?utf8=%E2%9C%93&q=indkey And some other kind of crazy looking PHP/wordpress thing: https://github.com/mfukano/wp-heroku/blob/a057cbeaf54297871c7cea7da73578fb3c6a4f12/wp-content/pg4wp/driver_pgsql_install.php#L99 Comments from Reviewable |
Review status: 2 of 5 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. pkg/sql/pg_catalog.go, line 817 at r2 (raw file): Previously, jordanlewis (Jordan Lewis) wrote…
I believe there are other, harder issues blocking Django, and I'm not clear how that specific code in PGJDBC gets executed (my tests haven't hit that code yet). That said, I'll see what it takes to support this in a better way. Comments from Reviewable |
Review status: 2 of 5 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. pkg/sql/pg_catalog.go, line 817 at r2 (raw file): Previously, cuongdo (Cuong Do) wrote…
Agreed that this isn't the first failure in either PGJDBC or Django, but my point was just that there's a lot of code that already relies on Comments from Reviewable |
8ac77e6
to
66a4d30
Compare
Rebased and introduced a new @nvanbenschoten Are there simpler ways to introduce a different serialization format for |
To confirm my understanding, it looks like |
From what I recall when I was testing Sequelize, I believe that Sequelize will be happy as long as the output column in question is sent with an int2vector OID. In other words, I don't think we need to worry about the data appearing in the int2vector format in You can test my belief by temporarily changing the switch in Review status: 2 of 19 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. Comments from Reviewable |
Regardless, I don't believe I can affect the OID of the outgoing column
without changing the ColumnDescriptor.
…On Thu, Feb 9, 2017 at 12:11 PM Jordan Lewis ***@***.***> wrote:
From what I recall when I was testing Sequelize, I believe that Sequelize
will be happy as long as the output column in question is sent with an
int2vector OID. In other words, I don't think we need to worry about the
data appearing in the int2vector format in ./cockroach sql.
You can test my belief by temporarily changing the switch in tArray.Oid()
in type.go to return T_int2vector for TypeInt instead of T__int8.
------------------------------
Review status: 2 of 19 files reviewed at latest revision, 1 unresolved
discussion, all commit checks successful.
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/cockroachdb/cockroach/13484#-:-KcYpKnd1zLFdmP7O8qJ:b-8wgc4h>*
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13484 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABffpjUBz3YkaCewTXFeaCbprTt6WuqXks5ra0ixgaJpZM4L7EH3>
.
|
@jordanlewis You are right that if I return Review status: 2 of 19 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. Comments from Reviewable |
Also, I'm going to leave the serialization changes in. This line from Sequelize depends on the fact that https://github.com/sequelize/sequelize/blob/v3/lib/dialects/postgres/query.js#L150 While it doesn't complain when it receives a string like Review status: 2 of 19 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. Comments from Reviewable |
Nice job tackling this! Reviewed 2 of 2 files at r1, 3 of 3 files at r3, 17 of 17 files at r4. pkg/sql/create.go, line 1160 at r4 (raw file):
Throughout: "array" should correspond to "vector", because we're referring to a generic data type. So pkg/sql/pg_catalog.go, line 828 at r4 (raw file):
Let's change this to pkg/sql/show.go, line 171 at r3 (raw file):
Why not just change the names in pkg/sql/parser/col_types.go, line 328 at r4 (raw file):
This was the approach I initially took with pkg/sql/parser/datum.go, line 2012 at r4 (raw file):
For pkg/sql/parser/datum.go, line 2159 at r4 (raw file):
let's move this up below pkg/sql/pgwire/types.go, line 181 at r4 (raw file):
I'd turn this into a pkg/sql/pgwire/types.go, line 185 at r4 (raw file):
pkg/sql/sqlbase/structured.go, line 1670 at r4 (raw file):
nit: move to below pkg/sql/sqlbase/structured.go, line 1720 at r4 (raw file):
same pkg/sql/sqlbase/structured.proto, line 44 at r4 (raw file):
Let's do something similar to below. Make this pkg/sql/sqlbase/testutils.go, line 136 at r4 (raw file):
arrays or vectors Comments from Reviewable |
66a4d30
to
e99cfce
Compare
Review status: 1 of 23 files reviewed at latest revision, 13 unresolved discussions, some commit checks failed. pkg/sql/create.go, line 1160 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/pg_catalog.go, line 828 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
How do I return a pkg/sql/show.go, line 171 at r3 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/parser/col_types.go, line 328 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/parser/datum.go, line 2012 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/parser/datum.go, line 2159 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/pgwire/types.go, line 181 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Much cleaner! Done pkg/sql/pgwire/types.go, line 185 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/sqlbase/structured.go, line 1670 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/sqlbase/structured.go, line 1720 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/sqlbase/structured.proto, line 44 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/sqlbase/testutils.go, line 136 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Comments from Reviewable |
e99cfce
to
5165637
Compare
Thanks for the thorough review, as always! Rebased and addressed comments Review status: 0 of 23 files reviewed at latest revision, 13 unresolved discussions. Comments from Reviewable |
@nvanbenschoten Any comments? There have been many recent changes to the type system, so I'd love to get further feedback. |
Reviewed 2 of 19 files at r5, 21 of 21 files at r6. pkg/sql/pg_catalog.go, line 828 at r4 (raw file): Previously, cuongdo (Cuong Do) wrote…
Good point, pkg/sql/pgwire/types.go, line 191 at r6 (raw file):
Let's just put a default case instead of enumerating all of these. Comments from Reviewable |
When responding to a SHOW (variable) statement, PostgreSQL lower-cases variable names in the column names of the result set. For example, `SHOW SERVER_VERSION` returns a result set with the single column name `server_version`. Sequelize depends on this behavior, so we now emulate it. Resolves cockroachdb#13465
`indkey` is an `int2vector`, which is serialized as a space-delimited string containing the elements of the vector. Sequelize relies on this representation, splitting `indkey` by spaces. This fixes compatibility with Sequelize and has been tested with Hibernate, GORM, and SQLAlchemy. This change adds an INT2VECTOR column type that maps to a new TypeIntVector/DIntVector that uses DOidWrapper to wrap DArray with the int2vector OID. The new column type allows the serialization of `indkey` to match what Postgres emits.
5165637
to
50c5517
Compare
Review status: 2 of 23 files reviewed at latest revision, 3 unresolved discussions. pkg/sql/pg_catalog.go, line 828 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/pgwire/types.go, line 191 at r6 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Comments from Reviewable |
These fixes make basic Sequelize CRUD operations work, except for upsert.
This change is