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/parser: annotate unimplemented features with suitable errors #31335

Merged
merged 1 commit into from Oct 15, 2018

Conversation

3 participants
@knz
Member

knz commented Oct 13, 2018

Requested by @awoods187.
Fixes #28301.
Fixes #28304.
Fixes #28302.
Fixes #28300.
Fixes #28297.
Fixes #28295.
Fixes #28294.
Fixes #28292.

This patch recognizes more syntax from PostgreSQL for the purpose of
reporting more fine grained "unimplemented feature" errors.

  • new:

    • CREATE/DROP
      AGGREGATE / CAST / COLLATION / CONVERSION / DOMAIN / EXTENSION /
      FOREIGN TABLE / FOREIGN DATA (WRAPPER) / FUNCTION / LANGUAGE /
      OPERATOR / PUBLICATION / RULE / SERVER / SUBSCRIPTION /
      TEXT (SEARCH) / TRIGGER / MATERIALIZED VIEW.
    • CREATE OR REPLACE VIEW
    • CREATE RECURSIVE VIEW
    • CREATE TEMP TABLE / VIEW / SEQUENCE and variants
    • CREATE INDEX USING GIST / HASH / SPGIST / BRIN
    • CREATE INDEX ... WHERE ... (partial indexes)
    • CREATE INDEX ON ... () (computed indexes)
    • CREATE GROUP is really an alias for CREATE USER and is not "unsupported"
    • type names point/circle/etc (unsupported pg data types)
    • INTERVAL SECONDS / MINUTES / etc (interval type with unit qualifier)
    • SELECT .. FOR UPDATE (and other locks)
    • Geometric types: POINT, CIRCLE etc
    • Other predefined pg types: XML, MACADDR, etc
    • Full text search: CREATE TEXT SEARCH, types TSVECTOR, TSQUERY, etc
  • modified:

    • COMMENT ON accounting split in "table", "column" and other
    • TIMETZ support accounting split in "data type" and "current_time"
    • WITH RECURSIVE gets an issue number

Additionally unimplemented feature errors that stem during parsing
will now be prefixed with syntax. to ease integration in the feature
count hierarchy.

Release note: None

@knz knz requested review from dt, bobvawter and BramGruneir Oct 13, 2018

@knz knz added this to Triage in SQL Front-end, Lang & Semantics via automation Oct 13, 2018

@knz knz requested review from cockroachdb/sql-language-prs as code owners Oct 13, 2018

@cockroach-teamcity

This comment has been minimized.

Show comment
Hide comment
@cockroach-teamcity

cockroach-teamcity Oct 13, 2018

Member

This change is Reviewable

Member

cockroach-teamcity commented Oct 13, 2018

This change is Reviewable

@knz knz requested a review from cockroachdb/core-prs as a code owner Oct 13, 2018

sql/parser: annotate unimplemented features with suitable errors
This patch recognizes more syntax from PostgreSQL for the purpose of
reporting more fine grained "unimplemented feature" errors.

- new:
  - CREATE/DROP
    AGGREGATE / CAST / COLLATION / CONVERSION / DOMAIN / EXTENSION /
    FOREIGN TABLE / FOREIGN DATA (WRAPPER) / FUNCTION / LANGUAGE /
    OPERATOR / PUBLICATION / RULE / SERVER / SUBSCRIPTION /
    TEXT (SEARCH) / TRIGGER / MATERIALIZED VIEW.
  - CREATE OR REPLACE VIEW
  - CREATE RECURSIVE VIEW
  - CREATE TEMP TABLE / VIEW / SEQUENCE and variants
  - CREATE INDEX USING GIST / HASH / SPGIST / BRIN
  - CREATE INDEX ... WHERE ... (partial indexes)
  - CREATE INDEX ON ... (<complex expr>)   (computed indexes)
  - CREATE GROUP is really an alias for CREATE USER and is not "unsupported"
  - type names point/circle/etc   (unsupported pg data types)
  - INTERVAL SECONDS / MINUTES / etc  (interval type with unit qualifier)
  - SELECT .. FOR UPDATE (and other locks)
  - Geometric types: POINT, CIRCLE etc
  - Other predefined pg types: XML, MACADDR, etc
  - Full text search: CREATE TEXT SEARCH, types TSVECTOR, TSQUERY, etc

- modified:
  - COMMENT ON accounting split in "table", "column" and other
  - TIMETZ support accounting split in "data type" and "current_time"
  - WITH RECURSIVE gets an issue number

Additionally unimplemented feature errors that stem during parsing
will now be prefixed with `syntax.` to ease integration in the feature
count hierarchy.

Release note: None
@dt

dt approved these changes Oct 14, 2018

Reviewed 7 of 9 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/sql/parser/parse.go, line 52 at r1 (raw file):

		var err *pgerror.Error
		if feat := p.scanner.lastError.unimplementedFeature; feat != "" {
			err = pgerror.UnimplementedWithDepth(depth+1, "syntax."+feat, p.scanner.lastError.msg)

this will change all the existing callers to have the prefix too now, which I guess is ok.

@knz

This comment has been minimized.

Show comment
Hide comment
@knz

knz Oct 15, 2018

Member

thanks

bors r+

Member

knz commented Oct 15, 2018

thanks

bors r+

craig bot pushed a commit that referenced this pull request Oct 15, 2018

Merge #31335
31335: sql/parser: annotate unimplemented features with suitable errors r=knz a=knz

Requested by @awoods187.
Fixes #28301.
Fixes #28304.
Fixes #28302.
Fixes #28300.
Fixes #28297.
Fixes #28295.
Fixes #28294.
Fixes #28292.

This patch recognizes more syntax from PostgreSQL for the purpose of
reporting more fine grained "unimplemented feature" errors.

- new:
  - CREATE/DROP
    AGGREGATE / CAST / COLLATION / CONVERSION / DOMAIN / EXTENSION /
    FOREIGN TABLE / FOREIGN DATA (WRAPPER) / FUNCTION / LANGUAGE /
    OPERATOR / PUBLICATION / RULE / SERVER / SUBSCRIPTION /
    TEXT (SEARCH) / TRIGGER / MATERIALIZED VIEW.
  - CREATE OR REPLACE VIEW
  - CREATE RECURSIVE VIEW
  - CREATE TEMP TABLE / VIEW / SEQUENCE and variants
  - CREATE INDEX USING GIST / HASH / SPGIST / BRIN
  - CREATE INDEX ... WHERE ... (partial indexes)
  - CREATE INDEX ON ... (<complex expr>)   (computed indexes)
  - CREATE GROUP is really an alias for CREATE USER and is not "unsupported"
  - type names point/circle/etc   (unsupported pg data types)
  - INTERVAL SECONDS / MINUTES / etc  (interval type with unit qualifier)
  - SELECT .. FOR UPDATE (and other locks)
  - Geometric types: POINT, CIRCLE etc
  - Other predefined pg types: XML, MACADDR, etc
  - Full text search: CREATE TEXT SEARCH, types TSVECTOR, TSQUERY, etc

- modified:
  - COMMENT ON accounting split in "table", "column" and other
  - TIMETZ support accounting split in "data type" and "current_time"
  - WITH RECURSIVE gets an issue number

Additionally unimplemented feature errors that stem during parsing
will now be prefixed with `syntax.` to ease integration in the feature
count hierarchy.

Release note: None

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig

This comment has been minimized.

Show comment
Hide comment
@craig

craig bot commented Oct 15, 2018

Build succeeded

@craig craig bot merged commit f1b1659 into cockroachdb:master Oct 15, 2018

3 checks passed

GitHub CI (Cockroach) TeamCity build finished
Details
bors Build succeeded
Details
license/cla Contributor License Agreement is signed.
Details

@knz knz deleted the knz:20181013-annotated-unimp branch Oct 15, 2018

@knz knz moved this from Triage to Current milestone in SQL Front-end, Lang & Semantics Oct 15, 2018

@knz knz moved this from Current milestone to Finished (milestone r2.1) in SQL Front-end, Lang & Semantics Oct 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment