-
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: more Postgres compatibility measures for ActiveRecord #13429
sql: more Postgres compatibility measures for ActiveRecord #13429
Conversation
a32f1c8
to
049f0b3
Compare
Reviewed 2 of 2 files at r1, 3 of 3 files at r2, 2 of 2 files at r3. pkg/sql/parser/builtins.go, line 1406 at r3 (raw file):
This description is now outdated pkg/sql/parser/builtins.go, line 1436 at r3 (raw file):
This is now outdated pkg/sql/testdata/builtin_function, line 1147 at r2 (raw file):
These tests aren't part of this commit pkg/sql/testdata/pgoidtype, line 12 at r1 (raw file):
could you also test with some whitespace before and after Comments from Reviewable |
1a96562
to
b852805
Compare
TFTR! Review status: 1 of 6 files reviewed at latest revision, 4 unresolved discussions. pkg/sql/parser/builtins.go, line 1406 at r3 (raw file): Previously, cuongdo (Cuong Do) wrote…
Done. pkg/sql/parser/builtins.go, line 1436 at r3 (raw file): Previously, cuongdo (Cuong Do) wrote…
Done. pkg/sql/testdata/builtin_function, line 1147 at r2 (raw file): Previously, cuongdo (Cuong Do) wrote…
Done. pkg/sql/testdata/pgoidtype, line 12 at r1 (raw file): Previously, cuongdo (Cuong Do) wrote…
Done. Comments from Reviewable |
Review status: 1 of 6 files reviewed at latest revision, 6 unresolved discussions, some commit checks pending. pkg/sql/parser/builtins.go, line 1410 at r4 (raw file):
This change should coordinate with #13404. pkg/sql/testdata/pgoidtype, line 12 at r4 (raw file):
Should something like Comments from Reviewable |
99b326f
to
2520cb0
Compare
Review status: 0 of 7 files reviewed at latest revision, 6 unresolved discussions. pkg/sql/testdata/pgoidtype, line 12 at r4 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Good point. Yes. That works now. Comments from Reviewable |
Review status: 0 of 7 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. pkg/sql/parser/eval.go, line 2220 at r8 (raw file):
It looks like newlines and tabs should also be stripped for whatever reason. pkg/sql/parser/eval.go, line 2221 at r8 (raw file):
We don't really need a regexp anymore then:
Comments from Reviewable |
Review status: 0 of 7 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. pkg/sql/parser/eval.go, line 2220 at r8 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. pkg/sql/parser/eval.go, line 2221 at r8 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Done. Comments from Reviewable |
1cb8586
to
f39d118
Compare
Reviewed 1 of 2 files at r5, 6 of 6 files at r9, 3 of 3 files at r10, 3 of 3 files at r11, 3 of 3 files at r12. pkg/sql/parser/builtins.go, line 1441 at r11 (raw file):
includes? pkg/sql/parser/builtins.go, line 1664 at r11 (raw file):
s/table/database/ on all three constants pkg/sql/parser/builtins.go, line 1674 at r11 (raw file):
how come not 'DB'? pkg/sql/parser/builtins.go, line 1675 at r11 (raw file):
might read better as a switch-case Comments from Reviewable |
f39d118
to
eb4916b
Compare
Review status: all files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. pkg/sql/parser/builtins.go, line 1441 at r11 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/parser/builtins.go, line 1664 at r11 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/parser/builtins.go, line 1674 at r11 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. pkg/sql/parser/builtins.go, line 1675 at r11 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
Reviewed 1 of 4 files at r13, 3 of 3 files at r14. pkg/sql/parser/builtins.go, line 1676 at r14 (raw file):
you can make this one single case
Comments from Reviewable |
eb4916b
to
3a1bae1
Compare
Review status: 3 of 7 files reviewed at latest revision, 8 unresolved discussions. pkg/sql/parser/builtins.go, line 1676 at r14 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
Reviewed 1 of 4 files at r15, 3 of 3 files at r16. Comments from Reviewable |
3a1bae1
to
660e82b
Compare
Reworked the Also added a few more commits with some new fixes for active record and updated the PR description to match. |
553e530
to
83bd928
Compare
Awesome, thanks. One request about a builtin description, though. Looks otherwise fine to me. Reviewed 1 of 3 files at r16, 1 of 4 files at r18, 3 of 3 files at r21, 1 of 1 files at r22. pkg/sql/parser/builtins.go, line 1395 at r22 (raw file):
Side note: The existence of both pkg/sql/parser/builtins.go, line 1421 at r22 (raw file):
Once Comments from Reviewable |
83bd928
to
64e0c1e
Compare
Review status: 3 of 8 files reviewed at latest revision, 8 unresolved discussions. pkg/sql/parser/builtins.go, line 1421 at r22 (raw file): Previously, knz (kena) wrote…
Done. Comments from Reviewable |
Postgres unwraps inner quotes when doing oid casts, and some ORMs rely on this behavior. For example, `'table'::REGCLASS` and `'"table"'::REGCLASS` are treated the same.
For postgres compatibility. Strings are called either text or varchar depending on their OID, despite their identical disk and syntax representation in CockroachDB.
CockroachDB doesn't support extensions, so this is an empty table. It's needed for ORM support.
pg_namespace now contains a single namespace for every database, including system ones, named as the database is. This corrects the broken link between what `current_schema` reports and the `pg_namespace` virtual table - this link is required for ORM compatibility. Previously, we implemented pg_namespace by exposing a single `public` namespace to which every user-created database was linked. This is inconsistent with Postgres as well as our future plans for schemas/namespaces. We no longer expose any namespaces with the name `public`.
These are required for ActiveRecord ORM support. We implement them by returning true no matter what.
For ORM compatibility.
For ORM compatibility.
64e0c1e
to
96e8bce
Compare
RFAL - is this good to go? |
It is for me! But I didn't feel I was primary reviewer :-)
Jordan Lewis <notifications@github.com> schreef op 10 februari 2017 17:36:07 CET:
…RFAL - is this good to go?
--
You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub:
#13429 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
I mainly didn't set you as a primary reviewer because you have been awfully busy - but I'm more than happy to take your LGTM if you're offering 😄 |
Review status: 0 of 8 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful. pkg/sql/parser/builtins.go, line 1680 at r30 (raw file):
I'm a little late to this PR, but it seems bad to lie about locking like this. Even if ActiveRecord is (currently) OK with us stubbing out this lock, implementing this function in a silently broken way could cause problems for other frameworks in the future. Comments from Reviewable |
Review status: 0 of 8 files reviewed at latest revision, 9 unresolved discussions, all commit checks successful. pkg/sql/parser/builtins.go, line 1680 at r30 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Good point. Opened #13546. Comments from Reviewable |
You should mention in your docs somewhere, that there are known limitations with your ActiveRecord compatibility and explain that these things are (mentioning this one). |
It stands for "thanks for the review" |
A few more compatibility features for ActiveRecord.
'"table"'::regclass
is equivalent to'table'::regclass
.pg_type
's entries for string types are now named the same as in Postgres:text
andvarchar
.pg_type
's entry for decimal types are now named the same as in Postgres:numeric
.pg_namespace
now has one entry per database.pg_extension
virtual table.current_database
builtin.obj_description
.Resolves #12153.
Resolves #12148.
Resolves #13436.
Resolves #13486.
Resolves #13485.
Resolves #13498.
This change is