Skip to content
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: support pg_catalog.regclass when casting #18856

Closed
robins opened this issue Sep 28, 2017 · 3 comments
Closed

sql: support pg_catalog.regclass when casting #18856

robins opened this issue Sep 28, 2017 · 3 comments
Labels
A-sql-name-resolution SQL name resolution rules and CTEs. A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@robins
Copy link

robins commented Sep 28, 2017

When casting, apparently Cockroachdb doesn't (yet) support pg_catalog.regclass although regclass works fine. It would help if CockroachDB could (eventually) support this, to avoid namespace clashes.

In Postgres

postgres2=> select 'a'::regclass::OID;
   oid
----------
 20041642
(1 row)
postgres2=> select 'a'::pg_catalog.regclass::OID;
   oid
----------
 20041642
(1 row)

In CockroachDB

bank=> \d a
                      Table "bank.a"
 Column |  Type  |     Collation     | Nullable | Default
--------+--------+-------------------+----------+---------
 b      | bigint | Not Supported Yet |          |
Indexes:
    "primary" PRIMARY KEY, (Not Supported Yet)
bank=> select 'a'::regclass::OID;
 'a'::REGCLASS::OID
--------------------
          818765073
(1 row)

bank=> select 'a'::pg_catalog.regclass::OID;
ERROR:  syntax error at or near "pg_catalog"
select 'a'::pg_catalog.regclass::OID;
            ^

Downstream issue robins/postgres#23 is dependent on this to be fixed.

@jordanlewis jordanlewis added the A-sql-pgcompat Semantic compatibility with PostgreSQL label Sep 29, 2017
@jordanlewis jordanlewis added this to the 1.2 milestone Sep 29, 2017
@jordanlewis jordanlewis self-assigned this Sep 29, 2017
@jordanlewis jordanlewis assigned knz and unassigned jordanlewis Feb 27, 2018
@knz knz modified the milestones: 2.0, 2.1 Feb 28, 2018
@knz
Copy link
Contributor

knz commented Feb 28, 2018

I have had a look into this. This is a larger issue than it first seemed because it requires a rather large refactor of our SQL grammar. Will look into it for 2.1 instead of 2.0.

@knz
Copy link
Contributor

knz commented Feb 28, 2018

Proposing #23208 but lemme see if my colleagues agree on having such a special case compatibility rule.

@knz knz added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-name-resolution SQL name resolution rules and CTEs. labels Apr 24, 2018
@knz knz changed the title Support pg_catalog.regclass when casting sql: support pg_catalog.regclass when casting Jul 23, 2018
@knz knz modified the milestones: 2.1, 2.2 Aug 30, 2018
@petermattis petermattis removed this from the 2.2 milestone Oct 5, 2018
@knz knz removed their assignment May 6, 2019
@jordanlewis
Copy link
Member

Closing as a duplicate of #16395.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-name-resolution SQL name resolution rules and CTEs. A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants