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

Support PLACEMENT KEY in column definition #193

Open
apstndb opened this issue Nov 5, 2024 · 1 comment
Open

Support PLACEMENT KEY in column definition #193

apstndb opened this issue Nov 5, 2024 · 1 comment

Comments

@apstndb
Copy link
Contributor

apstndb commented Nov 5, 2024

Syntax

https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#create_table

CREATE TABLE [ IF NOT EXISTS ] table_name ( [
   { column_name data_type [NOT NULL]
     [ { DEFAULT ( expression ) | AS ( expression ) [ STORED ]
       | GENERATED BY DEFAULT AS IDENTITY [ ( sequence_option_clause ... ) ] } ]
     [ PRIMARY KEY ]
     [ options_def ]
   | location_name STRING(MAX) NOT NULL PLACEMENT KEY
   | table_constraint
   | synonym_definition }
   [, ... ]
] )

Example

https://cloud.google.com/spanner/docs/create-manage-data-placements#create-table

CREATE TABLE Singers (
  SingerId INT64 NOT NULL,
  SingerName STRING(MAX) NOT NULL,
  Location STRING(MAX) NOT NULL PLACEMENT KEY
) PRIMARY KEY (SingerId);
@apstndb
Copy link
Contributor Author

apstndb commented Jan 11, 2025

May it be better to be parsed as {PRIMARY|PLACEMENT} KEY, but it requires a breaking change.
(I believe that there is no user pasing inline PRIMARY KEY.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant