-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from cvng/create-table-tests
- Loading branch information
Showing
13 changed files
with
1,725 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE UNLOGGED TABLE cities (name text, population real, altitude double, identifier smallint, postal_code int, foreign_id bigint); | ||
/* TODO: CREATE TABLE IF NOT EXISTS distributors (name varchar(40) DEFAULT 'Luso Films', len interval hour to second(3), name varchar(40) DEFAULT 'Luso Films', did int DEFAULT nextval('distributors_serial'), stamp timestamp DEFAULT now() NOT NULL, stamptz timestamp with time zone, "time" time NOT NULL, timetz time with time zone, CONSTRAINT name_len PRIMARY KEY (name, len)); */ SELECT 1; | ||
/* TODO: CREATE TABLE types (a real, b double precision, c numeric(2, 3), d char(4), e char(5), f varchar(6), g varchar(7)); */ SELECT 1; | ||
/* TODO: CREATE TABLE types (a geometry(point) NOT NULL); */ SELECT 1; | ||
CREATE TABLE tablename (colname int NOT NULL DEFAULT nextval('tablename_colname_seq')); | ||
CREATE TABLE capitals (state char(2)) INHERITS (cities); | ||
/* TODO: CREATE TEMPORARY TABLE temp AS SELECT c FROM t; */ SELECT 1; | ||
/* TODO: CREATE TABLE films2 AS SELECT * FROM films; */ SELECT 1; | ||
/* TODO: CREATE TEMPORARY TABLE films_recent ON COMMIT DROP AS SELECT * FROM films WHERE date_prod > $1; */ SELECT 1; | ||
CREATE TABLE like_constraint_rename_cache (LIKE constraint_rename_cache INCLUDING ALL); | ||
CREATE TABLE distributors (did int, name varchar(40), UNIQUE (name) WITH (fillfactor=70)) WITH (fillfactor=70); |
412 changes: 412 additions & 0 deletions
412
crates/parser/tests/snapshots/statements/valid/[email protected]
Large diffs are not rendered by default.
Oops, something went wrong.
82 changes: 82 additions & 0 deletions
82
crates/parser/tests/snapshots/statements/valid/[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
source: crates/parser/tests/statement_parser_test.rs | ||
description: CREATE TABLE like_constraint_rename_cache (LIKE constraint_rename_cache INCLUDING ALL); | ||
--- | ||
Parse { | ||
cst: SourceFile@0..87 | ||
CreateStmt@0..87 | ||
Create@0..6 "CREATE" | ||
Whitespace@6..7 " " | ||
Table@7..12 "TABLE" | ||
Whitespace@12..13 " " | ||
RangeVar@13..41 | ||
Ident@13..41 "like_constraint_renam ..." | ||
Whitespace@41..42 " " | ||
Ascii40@42..43 "(" | ||
TableLikeClause@43..85 | ||
Like@43..47 "LIKE" | ||
Whitespace@47..48 " " | ||
RangeVar@48..71 | ||
Ident@48..71 "constraint_rename_cache" | ||
Whitespace@71..72 " " | ||
Including@72..81 "INCLUDING" | ||
Whitespace@81..82 " " | ||
All@82..85 "ALL" | ||
Ascii41@85..86 ")" | ||
Ascii59@86..87 ";" | ||
, | ||
errors: [], | ||
stmts: [ | ||
RawStmt { | ||
stmt: CreateStmt( | ||
CreateStmt { | ||
relation: Some( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "like_constraint_rename_cache", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 13, | ||
}, | ||
), | ||
table_elts: [ | ||
Node { | ||
node: Some( | ||
TableLikeClause( | ||
TableLikeClause { | ||
relation: Some( | ||
RangeVar { | ||
catalogname: "", | ||
schemaname: "", | ||
relname: "constraint_rename_cache", | ||
inh: true, | ||
relpersistence: "p", | ||
alias: None, | ||
location: 48, | ||
}, | ||
), | ||
options: 2147483647, | ||
relation_oid: 0, | ||
}, | ||
), | ||
), | ||
}, | ||
], | ||
inh_relations: [], | ||
partbound: None, | ||
partspec: None, | ||
of_typename: None, | ||
constraints: [], | ||
options: [], | ||
oncommit: OncommitNoop, | ||
tablespacename: "", | ||
access_method: "", | ||
if_not_exists: false, | ||
}, | ||
), | ||
range: 0..86, | ||
}, | ||
], | ||
} |
Oops, something went wrong.