Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore(pg): comprehensive completion test coverage [BYT-9026] (#19683)

rebelicec3b542ca5f05
diff --git a/backend/plugin/parser/pg/SCENARIOS.md b/backend/plugin/parser/pg/SCENARIOS.md
new file mode 100644
index 0000000000..d647a3246c
--- /dev/null
+++ b/backend/plugin/parser/pg/SCENARIOS.md
@@ -0,0 +1,252 @@
+# PG Completion Scenarios
+
+> Goal: Comprehensive test coverage for PostgreSQL autocompletion across all SQL contexts
+> Verification: `go test -v -count=1 github.com/bytebase/bytebase/backend/plugin/parser/pg -run ^TestCompletion$`
+> Reference sources: PostgreSQL documentation, omni parser grammar rules, completion.go source code
+
+Status: [ ] pending, [x] passing, [~] partial (needs upstream change)
+
+---
+
+## Phase 1: Foundation Gaps
+
+Fill missing coverage for features already partially tested.
+
+### 1.1 Join Variants
+
+- [x] `SELECT | FROM t1 RIGHT JOIN t2 ON t1.c1 = t2.c1` — columns from both tables visible in RIGHT JOIN
+- [x] `SELECT | FROM t1 FULL OUTER JOIN t2 ON t1.c1 = t2.c1` — columns from both tables visible in FULL OUTER JOIN
+- [x] `SELECT | FROM t1 CROSS JOIN t2` — columns from both tables visible in CROSS JOIN (no ON clause)
+- [x] `SELECT | FROM t1 NATURAL JOIN t2` — columns from both tables visible in NATURAL JOIN
+- [x] `SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 = t2.| ` — qualified column in RIGHT JOIN ON condition
+- [x] `SELECT * FROM t1 FULL OUTER JOIN t2 ON t1.c1 = t2.|` — qualified column in FULL OUTER JOIN ON condition
+- [x] `SELECT * FROM t1 CROSS JOIN t2 WHERE t1.|` — qualified column in WHERE after CROSS JOIN
+- [x] `SELECT * FROM t1 JOIN t2 USING (|)` — columns common to both tables in USING clause
+- [x] `SELECT | FROM t1 JOIN t2 ON t1.c1 = t2.c1 LEFT JOIN test.auto ON t2.c1 = test.auto.id` — mixed join types with cross-schema
+- [x] `SELECT a.| FROM t1 a NATURAL JOIN t2 b` — alias-qualified columns after NATURAL JOIN
+
+### 1.2 Advanced WHERE Expressions
+
+- [x] `SELECT * FROM t2 WHERE c1 BETWEEN | AND c2` — completion after BETWEEN
+- [x] `SELECT * FROM t2 WHERE c1 BETWEEN c2 AND |` — completion after AND in BETWEEN
+- [x] `SELECT * FROM test.auto WHERE name LIKE |` — completion after LIKE
+- [x] `SELECT * FROM t2 WHERE c1 IS NOT NULL AND |` — completion after IS NOT NULL condition
+- [x] `SELECT * FROM t2 WHERE c1 IS NULL OR |` — completion after IS NULL condition
+- [x] `SELECT * FROM t2 WHERE NOT |` — completion after NOT
+- [x] `SELECT * FROM t2 WHERE c1 > | ` — completion after comparison operator
+- [x] `SELECT * FROM t2 WHERE c1 + | > 0` — completion in arithmetic expression
+- [x] `SELECT * FROM t2 WHERE c1 IN (1, 2) AND |` — completion after IN list
+- [x] `SELECT * FROM t1 WHERE c1 = (SELECT MAX(|) FROM t2)` — completion inside aggregate in scalar subquery
+- [x] `SELECT * FROM t1 x WHERE x.c1 IN (SELECT c1 FROM t2 WHERE |)` — completion in correlated subquery WHERE
+- [x] `SELECT * FROM t2 WHERE CASE WHEN c1 > 0 THEN | END = 1` — completion in CASE WHEN THEN
+
+### 1.3 Advanced SELECT Features
+
+- [x] `SELECT DISTINCT | FROM t2` — columns after DISTINCT
+- [x] `SELECT DISTINCT ON (|) c1, c2 FROM t2` — columns in DISTINCT ON
+- [x] `SELECT | FROM t2 LIMIT 10` — columns in SELECT with LIMIT present
+- [x] `SELECT * FROM t2 LIMIT |` — completion in LIMIT expression
+- [x] `SELECT * FROM t2 OFFSET |` — completion in OFFSET expression
+- [x] `SELECT * FROM t2 ORDER BY c1 LIMIT |` — completion in LIMIT after ORDER BY
+- [x] `SELECT c1, | FROM t2` — completion for second column in select list
+- [x] `DELETE FROM t2 WHERE c1 > 0 RETURNING |` — completion in RETURNING clause (DML)
+- [x] `UPDATE t2 SET c1 = 1 RETURNING |` — completion in UPDATE RETURNING clause
+- [x] `SELECT c1, SUM(c2) OVER (PARTITION BY |) FROM t2` — column in window PARTITION BY
+- [x] `SELECT c1, SUM(c2) OVER (ORDER BY |) FROM t2` — column in window ORDER BY
+- [x] `SELECT c1, ROW_NUMBER() OVER (PARTITION BY | ORDER BY c1) FROM t2` — column in window function
+- [x] `SELECT COALESCE(|, 0) FROM t2` — completion in COALESCE first argument
+- [x] `SELECT COALESCE(c1, |) FROM t2` — completion in COALESCE second argument
+- [x] `SELECT NULLIF(|, 0) FROM t2` — completion in NULLIF
+- [x] `SELECT CAST(| AS int) FROM t2` — completion in CAST expression
+- [x] `SELECT | FROM t2 FOR UPDATE` — columns with FOR UPDATE locking clause
+
+### 1.4 Object Type Coverage
+
+- [x] `SELECT * FROM |` with foreign tables in metadata — foreign tables appear in FROM completion
+- [x] `SELECT * FROM |` with materialized views in metadata — materialized views appear in FROM completion
+- [x] `SELECT * FROM public.|` with foreign tables — foreign tables in schema-qualified FROM
+- [x] `SELECT * FROM public.|` with materialized views — materialized views in schema-qualified FROM
+- [x] `SELECT mv1.| FROM mv1` — columns from materialized view (qualified)
+- [x] `SELECT | FROM mv1` — columns from materialized view (unqualified)
+- [x] `SELECT ft1.| FROM ft1` — columns from foreign table (qualified)
+- [x] `SELECT | FROM ft1` — columns from foreign table (unqualified)
+- [x] `INSERT INTO |` with foreign tables — foreign tables in INSERT target
+- [~] `UPDATE |` with materialized views — materialized views should NOT appear in UPDATE target (they are read-only; completion engine uses same relation_expr rule for SELECT/UPDATE/DELETE and doesn't distinguish context)
+
+---
+
+## Phase 2: DDL Contexts
+
+Completion in DDL statements. Independent of Phase 1 — can run in parallel. Many scenarios likely need `completion.go` changes or omni parser grammar support; mark `[~]` if blocked.
+
+### 2.1 CREATE Statements
+
+- [x] `CREATE TABLE test_tbl (id int, FOREIGN KEY (id) REFERENCES |)` — table completion in FK reference
+- [x] `CREATE TABLE test_tbl (id int, FOREIGN KEY (id) REFERENCES public.|)` — schema-qualified FK reference
+- [x] `CREATE TABLE test_tbl (id int REFERENCES |)` — inline FK reference
+- [x] `CREATE TABLE test_tbl (id int REFERENCES t1(|))` — column completion in FK reference
+- [x] `CREATE INDEX idx ON |` — table completion in CREATE INDEX
+- [x] `CREATE INDEX idx ON public.|` — schema-qualified table in CREATE INDEX
+- [x] `CREATE INDEX idx ON t1 (|)` — column completion in index expression
+- [x] `CREATE INDEX idx ON t2 (c1, |)` — second column in composite index
+- [x] `CREATE VIEW v2 AS SELECT | FROM t1` — completion in CREATE VIEW body
+- [x] `CREATE VIEW v2 AS SELECT * FROM |` — FROM completion in CREATE VIEW body
+- [x] `CREATE MATERIALIZED VIEW mv AS SELECT | FROM t1` — completion in CREATE MATERIALIZED VIEW body
+- [x] `CREATE TABLE test_tbl AS SELECT | FROM t1` — completion in CREATE TABLE AS SELECT
+- [x] `CREATE TABLE test_tbl (LIKE |)` — table completion in LIKE clause
+- [x] `CREATE TRIGGER trig AFTER INSERT ON |` — table completion in CREATE TRIGGER
+- [x] `CREATE TRIGGER trig AFTER INSERT ON public.|` — schema-qualified table in CREATE TRIGGER
+
+### 2.2 ALTER Statements
+
+- [x] `ALTER TABLE |` — table completion in ALTER TABLE
+- [x] `ALTER TABLE public.|` — schema-qualified table in ALTER TABLE
+- [x] `ALTER TABLE t1 ADD COLUMN c2 int REFERENCES |` — FK reference in ALTER ADD COLUMN
+- [x] `ALTER TABLE t1 DROP COLUMN |` — column completion for existing columns
+- [x] `ALTER TABLE t1 RENAME COLUMN | TO new_name` — column completion in RENAME
+- [x] `ALTER TABLE t1 ALTER COLUMN |` — column completion in ALTER COLUMN
+- [x] `ALTER TABLE t1 ALTER COLUMN | SET NOT NULL` — column completion with SET NOT NULL
+- [x] `ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (|) REFERENCES t2` — column in FK constraint
+- [x] `ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (c1) REFERENCES t2(|)` — referenced column
+- [x] `ALTER INDEX | RENAME TO new_name` — index completion in ALTER INDEX
+- [x] `ALTER VIEW |` — view completion in ALTER VIEW
+- [x] `ALTER VIEW public.|` — schema-qualified view in ALTER VIEW
+- [x] `ALTER SEQUENCE |` — sequence completion in ALTER SEQUENCE
+- [x] `ALTER SEQUENCE public.|` — schema-qualified sequence
+- [x] `ALTER MATERIALIZED VIEW |` — materialized view completion
+
+### 2.3 DROP and TRUNCATE Statements
+
+- [x] `DROP TABLE |` — table completion in DROP TABLE
+- [x] `DROP TABLE public.|` — schema-qualified table in DROP
+- [x] `DROP TABLE IF EXISTS |` — table completion after IF EXISTS
+- [x] `DROP VIEW |` — view completion in DROP VIEW
+- [x] `DROP VIEW public.|` — schema-qualified view in DROP VIEW
+- [x] `DROP INDEX |` — index completion in DROP INDEX
+- [x] `DROP SEQUENCE |` — sequence completion in DROP SEQUENCE
+- [x] `DROP MATERIALIZED VIEW |` — materialized view in DROP
+- [x] `TRUNCATE |` — table completion in TRUNCATE
+- [x] `TRUNCATE public.|` — schema-qualified table in TRUNCATE
+
+### 2.4 COMMENT and GRANT Statements
+
+- [x] `COMMENT ON TABLE |` — table completion in COMMENT ON
+- [x] `COMMENT ON TABLE public.|` — schema-qualified table in COMMENT ON
+- [x] `COMMENT ON COLUMN t1.|` — column completion in COMMENT ON COLUMN
+- [x] `COMMENT ON COLUMN public.t1.|` — schema-qualified column in COMMENT ON COLUMN
+- [x] `GRANT SELECT ON |` — table completion in GRANT
+- [x] `GRANT SELECT ON public.|` — schema-qualified table in GRANT
+- [x] `GRANT ALL ON ALL TABLES IN SCHEMA |` — schema completion in GRANT
+- [x] `REVOKE SELECT ON |` — table completion in REVOKE
+- [x] `REVOKE SELECT ON public.|` — schema-qualified table in REVOKE
+- [x] `GRANT USAGE ON SEQUENCE |` — sequence completion in GRANT
+
+---
+
+## Phase 3: Advanced Query Patterns
+
+Complex query structures and nesting. Independent of Phase 2. Sections 3.1 and 3.2 may need `completion.go` scope-tracking changes.
+
+### 3.1 Recursive CTEs and CTEs in DML
+
+- [~] `WITH RECURSIVE x AS (SELECT c1 FROM t1 UNION ALL SELECT | FROM x JOIN t1 ON x.c1 = t1.c1) SELECT * FROM x` — completion in recursive branch (only t1 columns resolve; recursive self-reference x does not contribute its own columns)
+- [~] `WITH RECURSIVE x AS (SELECT c1 FROM t1 UNION ALL SELECT x.| FROM x JOIN t1 ON x.c1 = t1.c1) SELECT * FROM x` — qualified columns from recursive CTE reference (no candidates returned; recursive self-reference columns not resolvable)
+- [x] `WITH x AS (SELECT * FROM t2) INSERT INTO t1 SELECT | FROM x` — CTE used in INSERT...SELECT
+- [x] `WITH x AS (SELECT c1, c2 FROM t2) UPDATE t1 SET c1 = (SELECT | FROM x)` — CTE in UPDATE scalar subquery
+- [x] `WITH x AS (SELECT * FROM t2) DELETE FROM t1 WHERE c1 IN (SELECT | FROM x)` — CTE in DELETE subquery
+- [~] `WITH a AS (SELECT c1 FROM t1), b AS (SELECT * FROM a) SELECT | FROM b` — chained CTEs (CTE referencing another CTE) (b's columns not resolved; query span cannot resolve SELECT * FROM a where a is a CTE)
+- [x] `WITH a AS (SELECT c1 FROM t1), b AS (SELECT a.| FROM a) SELECT * FROM b` — qualified column in chained CTE
+- [x] `WITH x AS (SELECT c1 FROM t1) SELECT | FROM x, t2` — CTE mixed with regular table in FROM
+- [x] `WITH x AS (SELECT c1 FROM t1) SELECT x.| FROM x JOIN t2 ON x.c1 = t2.c1` — CTE qualified columns in JOIN
+- [x] `WITH x(a, b) AS (SELECT c1, c2 FROM t2) SELECT | FROM x JOIN t1 ON x.a = t1.c1` — named CTE columns in JOIN
+
+### 3.2 LATERAL Joins and Table Functions
+
+- [x] `SELECT * FROM t1, LATERAL (SELECT | FROM t2 WHERE t2.c1 = t1.c1) sub` — LATERAL subquery referencing outer table
+- [x] `SELECT sub.| FROM t1, LATERAL (SELECT c1, c2 FROM t2 WHERE t2.c1 = t1.c1) sub` — columns from LATERAL subquery alias
+- [x] `SELECT | FROM t1 LEFT JOIN LATERAL (SELECT * FROM t2 WHERE t2.c1 = t1.c1) sub ON true` — LATERAL with LEFT JOIN
+- [x] `SELECT * FROM t1, LATERAL (SELECT t1.| FROM t2) sub` — outer table column access in LATERAL
+- [x] `SELECT * FROM t2 x, LATERAL (SELECT x.| FROM t1) sub` — alias-qualified outer reference in LATERAL
+- [x] `SELECT | FROM generate_series(1, 10) g` — table function in FROM clause
+- [~] `SELECT g.| FROM generate_series(1, 10) g` — qualified column from table function alias (no candidates returned; table functions have no column metadata in the completion engine)
+- [x] `SELECT | FROM t1, generate_series(1, 10) g` — table function with regular table
+- [x] `SELECT | FROM t2 x, LATERAL (SELECT * FROM t1 WHERE t1.c1 = x.c1) sub` — complex LATERAL with alias
+
+### 3.3 Nested Subqueries and Expressions
+
+- [x] `SELECT (SELECT | FROM t1) FROM t2` — scalar subquery in SELECT list
+- [x] `SELECT (SELECT t1.| FROM t1) FROM t2` — qualified column in scalar subquery
+- [x] `SELECT * FROM t1 WHERE c1 = ANY(SELECT | FROM t2)` — ANY subquery
+- [x] `SELECT * FROM t1 WHERE c1 = ALL(SELECT | FROM t2)` — ALL subquery
+- [x] `SELECT * FROM t1 WHERE c1 > (SELECT MAX(|) FROM t2)` — aggregate in scalar subquery
+- [x] `SELECT * FROM (SELECT * FROM (SELECT | FROM t1) a) b` — triple-nested subquery
+- [x] `SELECT b.| FROM (SELECT * FROM (SELECT c1 FROM t1) a) b` — qualified column from triple-nested
+- [x] `SELECT * FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.c1 = t1.|)` — correlated subquery referencing outer column
+- [x] `SELECT | FROM (SELECT c1, c2 FROM t2 UNION SELECT c1, c2 FROM t2) sub` — subquery with UNION
+- [x] `SELECT sub.| FROM (SELECT c1, c2 FROM t2 UNION SELECT c1, c2 FROM t2) sub` — qualified columns from UNION subquery
+
+### 3.4 Set Operations
+
+- [x] `SELECT c1 FROM t1 INTERSECT SELECT | FROM t2` — SELECT list in INTERSECT
+- [x] `SELECT c1 FROM t1 EXCEPT SELECT | FROM t2` — SELECT list in EXCEPT
+- [x] `SELECT c1 FROM t1 UNION SELECT c1 FROM t1 UNION SELECT | FROM t2` — triple UNION
+- [x] `(SELECT c1 FROM t1) UNION (SELECT | FROM t2)` — parenthesized set operation
+- [x] `SELECT c1 FROM t1 UNION ALL SELECT c1 FROM t2 ORDER BY |` — ORDER BY on UNION result
+- [x] `SELECT * FROM (SELECT c1 FROM t1 UNION SELECT c1 FROM t2) x WHERE x.|` — WHERE on UNION subquery
+- [x] `WITH x AS (SELECT c1 FROM t1 UNION SELECT c1 FROM t2) SELECT x.| FROM x` — CTE with UNION body
+- [x] `SELECT c1 FROM t1 EXCEPT ALL SELECT | FROM t2` — EXCEPT ALL variant
+- [x] `SELECT c1 FROM t1 INTERSECT ALL SELECT | FROM t2` — INTERSECT ALL variant
+- [x] `SELECT | FROM t2 UNION SELECT * FROM t1` — first branch of UNION
+
+---
+
+## Phase 4: Edge Cases & Robustness
+
+Identifier handling, error recovery, and special scenarios.
+
+### 4.1 Quoted Identifiers and Reserved Keywords
+
+- [x] `SELECT | FROM "t1"` — quoted table name in FROM (should resolve t1 columns)
+- [x] `SELECT "t1".| FROM t1` — quoted table qualifier
+- [x] `SELECT * FROM "public".|` — quoted schema name
+- [x] `SELECT * FROM |` with table named using reserved keyword (metadata has table named "order") — reserved keyword table appears quoted
+- [x] `SELECT | FROM "order"` — columns from reserved-keyword-named table
+- [x] `SELECT "order".| FROM "order"` — qualified columns from reserved-keyword table
+- [x] `SELECT * FROM |` with mixed-case table name (metadata has "MyTable") — mixed-case name appears quoted
+- [x] `SELECT | FROM "MyTable"` — columns from mixed-case table
+- [x] `SELECT * FROM |` with table containing special chars (metadata has "my-table") — special char name appears quoted
+- [x] `SELECT * FROM public."t1" WHERE |` — columns after quoted schema-qualified table
+
+### 4.2 Partial Prefix Completion
+
+- [x] `SELECT * FROM t|` — partial table name prefix "t" matches t1, t2
+- [x] `SELECT * FROM public.t|` — partial schema-qualified prefix
+- [x] `SELECT t1.c|` — partial column name prefix
+- [x] `SELECT * FROM test.a|` — partial prefix in non-default schema
+- [x] `SELECT * FROM tes|` — partial schema name prefix
+- [x] `SELECT * FROM t1 WHERE t1.c|` — partial column in WHERE
+- [x] `INSERT INTO t|` — partial table name in INSERT
+- [x] `UPDATE t|` — partial table name in UPDATE
+- [x] `DELETE FROM t|` — partial table name in DELETE
+- [x] `SELECT * FROM t1 JOIN t|` — partial table name in JOIN
+
+### 4.3 Multi-Statement and Error Recovery
+
+- [x] `SELECT 1; INSERT INTO |` — completion in second statement (INSERT)
+- [x] `SELECT 1; UPDATE |` — completion in second statement (UPDATE)
+- [x] `SELECT 1; DELETE FROM |` — completion in second statement (DELETE)
+- [x] `INVALID SQL; SELECT * FROM |` — recovery after invalid first statement
+- [x] `SELECT * FROM t1; SELECT * FROM t2 WHERE |` — columns from correct table in second statement
+- [x] `SELECT; SELECT | FROM t1` — recovery after incomplete SELECT
+- [x] `SELECT * FROM t1 WHERE; SELECT | FROM t2` — recovery after incomplete WHERE
+- [x] `CREATE TABLE x (id int); SELECT | FROM t1` — DDL then DML multi-statement
+
+### 4.4 Whitespace and Formatting Variations
+
+- [x] Multi-line SELECT: `SELECT\n |\nFROM t1` — completion works across line breaks
+- [x] Multi-line FROM: `SELECT *\nFROM\n |` — FROM on separate line
+- [x] Tab-indented: `SELECT\t|\tFROM t1` — tab characters in SQL
+- [x] Extra whitespace: `SELECT * FROM |` — multiple spaces between tokens
+- [x] Trailing whitespace: `SELECT * FROM t1 WHERE | ` — space after cursor
+- [x] Comment before cursor: `SELECT * FROM /* comment */ |` — completion after block comment
+- [x] Line comment: `SELECT * FROM t1 -- comment\nWHERE |` — completion after line comment
diff --git a/backend/plugin/parser/pg/completion.go b/backend/plugin/parser/pg/completion.go
index a9aa8e0557..bcc553bf94 100644
--- a/backend/plugin/parser/pg/completion.go
+++ b/backend/plugin/parser/pg/completion.go
@@ -6,8 +6,10 @@ import (
"slices"
"strings"
"unicode"
+ "unicode/utf8"
"github.com/antlr4-go/antlr/v4"
+ pgparser "github.com/bytebase/omni/pg/parser"
pg "github.com/bytebase/parser/postgresql"
"github.com/bytebase/bytebase/backend/generated-go/store"
@@ -15,13 +17,6 @@ import (
"github.com/bytebase/bytebase/backend/store/model"
)
-var (
- // globalFollowSetsByState is the global follow sets by state.
- // It is shared by all PostgreSQL completers.
- // The FollowSetsByState is the thread-safe struct.
- globalFollowSetsByState = base.NewFollowSetsByState()
-)
-
func init() {
base.RegisterCompleteFunc(store.Engine_POSTGRES, Completion)
base.RegisterCompleteFunc(store.Engine_SNOWFLAKE, Completion)
@@ -43,121 +38,74 @@ func Completion(ctx context.Context, cCtx base.CompletionContext, statement stri
return trickyCompleter.completion()
}
-func newIgnoredTokens() map[int]bool {
- return map[int]bool{
- antlr.TokenEOF: true,
- pg.PostgreSQLLexerDollar: true,
- pg.PostgreSQLLexerOPEN_PAREN: true,
- pg.PostgreSQLLexerCLOSE_PAREN: true,
- pg.PostgreSQLLexerOPEN_BRACKET: true,
- pg.PostgreSQLLexerCLOSE_BRACKET: true,
- pg.PostgreSQLLexerCOMMA: true,
- pg.PostgreSQLLexerSEMI: true,
- pg.PostgreSQLLexerCOLON: true,
- pg.PostgreSQLLexerEQUAL: true,
- pg.PostgreSQLLexerDOT: true,
- pg.PostgreSQLLexerPLUS: true,
- pg.PostgreSQLLexerMINUS: true,
- pg.PostgreSQLLexerSLASH: true,
- pg.PostgreSQLLexerCARET: true,
- pg.PostgreSQLLexerLT: true,
- pg.PostgreSQLLexerGT: true,
- pg.PostgreSQLLexerLESS_LESS: true,
- pg.PostgreSQLLexerGREATER_GREATER: true,
- pg.PostgreSQLLexerCOLON_EQUALS: true,
- pg.PostgreSQLLexerLESS_EQUALS: true,
- pg.PostgreSQLLexerEQUALS_GREATER: true,
- pg.PostgreSQLLexerGREATER_EQUALS: true,
- pg.PostgreSQLLexerDOT_DOT: true,
- pg.PostgreSQLLexerNOT_EQUALS: true,
- pg.PostgreSQLLexerTYPECAST: true,
- pg.PostgreSQLLexerPERCENT: true,
- pg.PostgreSQLLexerPARAM: true,
- pg.PostgreSQLLexerOperator: true,
- pg.PostgreSQLLexerIdentifier: true,
- pg.PostgreSQLLexerQuotedIdentifier: true,
- pg.PostgreSQLLexerUnterminatedQuotedIdentifier: true,
- pg.PostgreSQLLexerInvalidQuotedIdentifier: true,
- pg.PostgreSQLLexerInvalidUnterminatedQuotedIdentifier: true,
- pg.PostgreSQLLexerUnicodeQuotedIdentifier: true,
- pg.PostgreSQLLexerUnterminatedUnicodeQuotedIdentifier: true,
- pg.PostgreSQLLexerInvalidUnicodeQuotedIdentifier: true,
- pg.PostgreSQLLexerInvalidUnterminatedUnicodeQuotedIdentifier: true,
- pg.PostgreSQLLexerStringConstant: true,
- pg.PostgreSQLLexerUnterminatedStringConstant: true,
- pg.PostgreSQLLexerUnicodeEscapeStringConstant: true,
- pg.PostgreSQLLexerUnterminatedUnicodeEscapeStringConstant: true,
- pg.PostgreSQLLexerBeginDollarStringConstant: true,
- pg.PostgreSQLLexerBinaryStringConstant: true,
- pg.PostgreSQLLexerUnterminatedBinaryStringConstant: true,
- pg.PostgreSQLLexerInvalidBinaryStringConstant: true,
- pg.PostgreSQLLexerInvalidUnterminatedBinaryStringConstant: true,
- pg.PostgreSQLLexerHexadecimalStringConstant: true,
- pg.PostgreSQLLexerUnterminatedHexadecimalStringConstant: true,
- pg.PostgreSQLLexerInvalidHexadecimalStringConstant: true,
- pg.PostgreSQLLexerInvalidUnterminatedHexadecimalStringConstant: true,
- pg.PostgreSQLLexerIntegral: true,
- pg.PostgreSQLLexerNumericFail: true,
- pg.PostgreSQLLexerNumeric: true,
+// computeSQLAndByteOffset converts (statement, caretLine, caretOffset) to
+// (trimmedSQL, byteOffset) for omni's parser.Collect API.
+func computeSQLAndByteOffset(statement string, caretLine int, caretOffset int, tricky bool) (string, int) {
+ var sql string
+ var newLine, newOffset int
+ if tricky {
+ sql, newLine, newOffset = skipHeadingSQLs(statement, caretLine, caretOffset)
+ sql, newLine, newOffset = skipHeadingSQLWithoutSemicolon(sql, newLine, newOffset)
+ } else {
+ sql, newLine, newOffset = skipHeadingSQLs(statement, caretLine, caretOffset)
}
+ return sql, lineColumnToByteOffset(sql, newLine, newOffset)
}
-func newPreferredRules() map[int]bool {
- return map[int]bool{
- pg.PostgreSQLParserRULE_relation_expr: true,
- pg.PostgreSQLParserRULE_qualified_name: true,
- pg.PostgreSQLParserRULE_columnref: true,
- pg.PostgreSQLParserRULE_func_name: true,
+// lineColumnToByteOffset converts 1-based line and 0-based column (character count)
+// to a byte offset. Column is measured in runes (characters), not bytes, so that
+// multi-byte UTF-8 characters are handled correctly.
+func lineColumnToByteOffset(sql string, line, column int) int {
+ currentLine := 1
+ for i := 0; i < len(sql); i++ {
+ if currentLine == line {
+ // Count 'column' runes from position i to get the byte offset.
+ pos := i
+ for c := 0; c < column && pos < len(sql); c++ {
+ _, size := utf8.DecodeRuneInString(sql[pos:])
+ pos += size
+ }
+ if pos > len(sql) {
+ return len(sql)
+ }
+ return pos
+ }
+ if sql[i] == '\n' {
+ currentLine++
+ }
}
+ return len(sql)
}
-func newNoSeparatorRequired() map[int]bool {
- return map[int]bool{
- pg.PostgreSQLLexerDollar: true,
- pg.PostgreSQLLexerOPEN_PAREN: true,
- pg.PostgreSQLLexerCLOSE_PAREN: true,
- pg.PostgreSQLLexerOPEN_BRACKET: true,
- pg.PostgreSQLLexerCLOSE_BRACKET: true,
- pg.PostgreSQLLexerCOMMA: true,
- pg.PostgreSQLLexerSEMI: true,
- pg.PostgreSQLLexerCOLON: true,
- pg.PostgreSQLLexerEQUAL: true,
- pg.PostgreSQLLexerDOT: true,
- pg.PostgreSQLLexerPLUS: true,
- pg.PostgreSQLLexerMINUS: true,
- pg.PostgreSQLLexerSLASH: true,
- pg.PostgreSQLLexerCARET: true,
- pg.PostgreSQLLexerLT: true,
- pg.PostgreSQLLexerGT: true,
- pg.PostgreSQLLexerLESS_LESS: true,
- pg.PostgreSQLLexerGREATER_GREATER: true,
- pg.PostgreSQLLexerCOLON_EQUALS: true,
- pg.PostgreSQLLexerLESS_EQUALS: true,
- pg.PostgreSQLLexerEQUALS_GREATER: true,
- pg.PostgreSQLLexerGREATER_EQUALS: true,
- pg.PostgreSQLLexerDOT_DOT: true,
- pg.PostgreSQLLexerNOT_EQUALS: true,
- pg.PostgreSQLLexerTYPECAST: true,
- pg.PostgreSQLLexerPERCENT: true,
- pg.PostgreSQLLexerPARAM: true,
- }
+// isNoSeparatorRequired returns true if tokenType is a punctuation/operator token
+// that does not require whitespace separation from the next token.
+func isNoSeparatorRequired(tokenType int) bool {
+ switch tokenType {
+ case '$', '(', ')', '[', ']', ',', ';', ':', '=', '.',
+ '+', '-', '/', '^', '<', '>', '%', '*',
+ pgparser.TYPECAST, pgparser.DOT_DOT, pgparser.COLON_EQUALS,
+ pgparser.EQUALS_GREATER, pgparser.LESS_EQUALS,
+ pgparser.GREATER_EQUALS, pgparser.NOT_EQUALS, pgparser.PARAM,
+ pgparser.Op:
+ return true
+ }
+ return false
}
type Completer struct {
- ctx context.Context
- core *base.CodeCompletionCore
- scene base.SceneType
- parser *pg.PostgreSQLParser
- lexer *pg.PostgreSQLLexer
- scanner *base.Scanner
- instanceID string
- defaultDatabase string
- defaultSchema string
- schemaNotSelected bool // true if user didn't explicitly select a schema
- getMetadata base.GetDatabaseMetadataFunc
- listDatabaseNames base.ListDatabaseNamesFunc
- metadataCache map[string]*model.DatabaseMetadata
- noSeparatorRequired map[int]bool
+ ctx context.Context
+ scene base.SceneType
+ sql string // the SQL statement (after skipHeadingSQLs)
+ cursorByteOffset int // byte offset in sql for omni Collect
+ tokens []pgparser.Token // omni tokens for the SQL
+ caretTokenIndex int // index in tokens at/near the caret
+ instanceID string
+ defaultDatabase string
+ defaultSchema string
+ schemaNotSelected bool
+ getMetadata base.GetDatabaseMetadataFunc
+ listDatabaseNames base.ListDatabaseNamesFunc
+ metadataCache map[string]*model.DatabaseMetadata
// referencesStack is a hierarchical stack of table references.
// We'll update the stack when we encounter a new FROM clauses.
referencesStack [][]base.TableReference
@@ -170,117 +118,150 @@ type Completer struct {
}
func NewTrickyCompleter(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int) *Completer {
- parser, lexer, scanner := prepareTrickyParserAndScanner(statement, caretLine, caretOffset)
- // For all PostgreSQL completers, we use one global follow sets by state.
- // The FollowSetsByState is the thread-safe struct.
- core := base.NewCodeCompletionCore(
- ctx,
- parser,
- newIgnoredTokens(),
- newPreferredRules(),
- &globalFollowSetsByState,
- pg.PostgreSQLParserRULE_simple_select_pramary,
- pg.PostgreSQLParserRULE_select_no_parens,
- pg.PostgreSQLParserRULE_target_alias,
- pg.PostgreSQLParserRULE_with_clause,
- )
+ sql, byteOffset := computeSQLAndByteOffset(statement, caretLine, caretOffset, true /* tricky */)
+ tokens := pgparser.Tokenize(sql)
+ caretTokenIndex := findCaretTokenIndex(tokens, byteOffset)
defaultSchema := cCtx.DefaultSchema
schemaNotSelected := defaultSchema == ""
if defaultSchema == "" {
defaultSchema = "public"
}
return &Completer{
- ctx: ctx,
- core: core,
- scene: cCtx.Scene,
- parser: parser,
- lexer: lexer,
- scanner: scanner,
- instanceID: cCtx.InstanceID,
- defaultDatabase: cCtx.DefaultDatabase,
- defaultSchema: defaultSchema,
- schemaNotSelected: schemaNotSelected,
- getMetadata: cCtx.Metadata,
- metadataCache: make(map[string]*model.DatabaseMetadata),
- noSeparatorRequired: newNoSeparatorRequired(),
- cteCache: make(map[int][]*base.VirtualTableReference),
+ ctx: ctx,
+ scene: cCtx.Scene,
+ sql: sql,
+ cursorByteOffset: byteOffset,
+ tokens: tokens,
+ caretTokenIndex: caretTokenIndex,
+ instanceID: cCtx.InstanceID,
+ defaultDatabase: cCtx.DefaultDatabase,
+ defaultSchema: defaultSchema,
+ schemaNotSelected: schemaNotSelected,
+ getMetadata: cCtx.Metadata,
+ listDatabaseNames: cCtx.ListDatabaseNames,
+ metadataCache: make(map[string]*model.DatabaseMetadata),
+ cteCache: make(map[int][]*base.VirtualTableReference),
}
}
func NewStandardCompleter(ctx context.Context, cCtx base.CompletionContext, statement string, caretLine int, caretOffset int) *Completer {
- parser, lexer, scanner := prepareParserAndScanner(statement, caretLine, caretOffset)
- // For all PostgreSQL completers, we use one global follow sets by state.
- // The FollowSetsByState is the thread-safe struct.
- core := base.NewCodeCompletionCore(
- ctx,
- parser,
- newIgnoredTokens(),
- newPreferredRules(),
- &globalFollowSetsByState,
- pg.PostgreSQLParserRULE_simple_select_pramary,
- pg.PostgreSQLParserRULE_select_no_parens,
- pg.PostgreSQLParserRULE_target_alias,
- pg.PostgreSQLParserRULE_with_clause,
- )
+ sql, byteOffset := computeSQLAndByteOffset(statement, caretLine, caretOffset, false /* tricky */)
+ tokens := pgparser.Tokenize(sql)
+ caretTokenIndex := findCaretTokenIndex(tokens, byteOffset)
defaultSchema := cCtx.DefaultSchema
schemaNotSelected := defaultSchema == ""
if defaultSchema == "" {
defaultSchema = "public"
}
return &Completer{
- ctx: ctx,
- core: core,
- scene: cCtx.Scene,
- parser: parser,
- lexer: lexer,
- scanner: scanner,
- instanceID: cCtx.InstanceID,
- defaultDatabase: cCtx.DefaultDatabase,
- defaultSchema: defaultSchema,
- schemaNotSelected: schemaNotSelected,
- getMetadata: cCtx.Metadata,
- metadataCache: make(map[string]*model.DatabaseMetadata),
- noSeparatorRequired: newNoSeparatorRequired(),
- cteCache: make(map[int][]*base.VirtualTableReference),
+ ctx: ctx,
+ scene: cCtx.Scene,
+ sql: sql,
+ cursorByteOffset: byteOffset,
+ tokens: tokens,
+ caretTokenIndex: caretTokenIndex,
+ instanceID: cCtx.InstanceID,
+ defaultDatabase: cCtx.DefaultDatabase,
+ defaultSchema: defaultSchema,
+ schemaNotSelected: schemaNotSelected,
+ getMetadata: cCtx.Metadata,
+ listDatabaseNames: cCtx.ListDatabaseNames,
+ metadataCache: make(map[string]*model.DatabaseMetadata),
+ cteCache: make(map[int][]*base.VirtualTableReference),
+ }
+}
+
+// findCaretTokenIndex returns the index of the first token whose start (Loc)
+// is at or past byteOffset. This matches ANTLR Scanner.SeekPosition semantics:
+// the caret token is the one that starts at or after the cursor position.
+// Uses >= so that when the cursor is exactly at a token boundary, we pick
+// that token (not the one before it).
+// Returns len(tokens) if all tokens are before byteOffset.
+func findCaretTokenIndex(tokens []pgparser.Token, byteOffset int) int {
+ for i, tok := range tokens {
+ if tok.Loc >= byteOffset {
+ return i
+ }
}
+ return len(tokens)
}
func (c *Completer) completion() ([]base.Candidate, error) {
- // Check the caret token is quoted or not.
- // This check should be done before checking the caret token is a separator or not.
- if c.scanner.IsTokenType(pg.PostgreSQLLexerQuotedIdentifier) ||
- c.scanner.IsTokenType(pg.PostgreSQLLexerInvalidQuotedIdentifier) ||
- c.scanner.IsTokenType(pg.PostgreSQLLexerUnicodeQuotedIdentifier) {
- c.caretTokenIsQuoted = true
+ // Check if the caret token is quoted.
+ if c.caretTokenIndex < len(c.tokens) {
+ tok := c.tokens[c.caretTokenIndex]
+ if tok.Type == pgparser.IDENT && tok.Loc < len(c.sql) && c.sql[tok.Loc] == '"' {
+ c.caretTokenIsQuoted = true
+ }
}
- caretIndex := c.scanner.GetIndex()
- if caretIndex > 0 && !c.noSeparatorRequired[c.scanner.GetPreviousTokenType(false /* skipHidden */)] {
+ caretIndex := c.caretTokenIndex
+ if caretIndex > 0 && !isNoSeparatorRequired(c.tokens[caretIndex-1].Type) {
caretIndex--
}
c.referencesStack = append([][]base.TableReference{{}}, c.referencesStack...)
- c.parser.Reset()
- var context antlr.ParserRuleContext
- if c.scene == base.SceneTypeQuery {
- context = c.parser.Selectstmt()
- } else {
- context = c.parser.Root()
- }
- candidates := c.core.CollectCandidates(caretIndex, context)
+ // Use omni parser to collect grammar candidates instead of C3.
+ candidates := pgparser.Collect(c.sql, c.cursorByteOffset)
+
+ // If Collect returned no rule candidates and the cursor is at the end of a
+ // partial identifier token (prefix), retry Collect at the start of that
+ // token. This enables completion for "SELECT * FROM t|" style inputs
+ // where the parser sees a complete token and doesn't know what grammar
+ // rule to suggest.
+ if len(candidates.Rules) == 0 {
+ if prefixTok, ok := c.prefixToken(); ok {
+ candidates = pgparser.Collect(c.sql, prefixTok.Loc)
+ }
+ }
- for ruleName := range candidates.Rules {
- if ruleName == pg.PostgreSQLParserRULE_columnref {
+ for _, rc := range candidates.Rules {
+ if rc.Rule == "columnref" {
c.collectLeadingTableReferences(caretIndex)
c.takeReferencesSnapshot()
c.collectRemainingTableReferences()
c.takeReferencesSnapshot()
+ break
}
}
return c.convertCandidates(candidates)
}
+// prefixToken returns the token immediately before (or containing) the cursor
+// position when that token is an identifier-like token that the user is still
+// typing. Returns false if no such token exists.
+func (c *Completer) prefixToken() (pgparser.Token, bool) {
+ // caretTokenIndex points to the first token at or past cursorByteOffset.
+ // The partial-prefix token is the one just before it (when the cursor is
+ // right after it) or the token itself (when the cursor is inside it).
+ idx := c.caretTokenIndex
+
+ // Check if the cursor is inside the token at caretTokenIndex.
+ if idx < len(c.tokens) {
+ tok := c.tokens[idx]
+ if tok.Loc < c.cursorByteOffset && c.cursorByteOffset <= tok.End && isIdentLikeToken(tok.Type) {
+ return tok, true
+ }
+ }
+
+ // Check the token before caretTokenIndex (cursor is right after it).
+ if idx > 0 {
+ tok := c.tokens[idx-1]
+ if tok.End == c.cursorByteOffset && isIdentLikeToken(tok.Type) {
+ return tok, true
+ }
+ }
+
+ return pgparser.Token{}, false
+}
+
+// isIdentLikeToken returns true for token types that represent identifiers or
+// unreserved keywords that a user might be partially typing.
+func isIdentLikeToken(tokenType int) bool {
+ return pgparser.IsIdentifierTokenType(tokenType)
+}
+
type CompletionMap map[string]base.Candidate
func (m CompletionMap) Insert(entry base.Candidate) {
@@ -424,20 +405,44 @@ func (m CompletionMap) insertColumns(c *Completer, schemas, tables map[string]bo
}
for table := range tables {
tableMeta := schemaMeta.GetTable(table)
- if tableMeta == nil {
+ if tableMeta != nil {
+ for _, column := range tableMeta.GetProto().GetColumns() {
+ definition := fmt.Sprintf("%s.%s | %s", schema, table, column.Type)
+ if !column.Nullable {
+ definition += ", NOT NULL"
+ }
+ m.Insert(base.Candidate{
+ Type: base.CandidateTypeColumn,
+ Text: c.quotedIdentifierIfNeeded(column.Name),
+ Definition: definition,
+ Comment: column.Comment,
+ })
+ }
continue
}
- for _, column := range tableMeta.GetProto().GetColumns() {
- definition := fmt.Sprintf("%s.%s | %s", schema, table, column.Type)
- if !column.Nullable {
- definition += ", NOT NULL"
+ // Check foreign tables.
+ if extMeta := schemaMeta.GetExternalTable(table); extMeta != nil {
+ for _, column := range extMeta.GetProto().GetColumns() {
+ definition := fmt.Sprintf("%s.%s | %s", schema, table, column.Type)
+ if !column.Nullable {
+ definition += ", NOT NULL"
+ }
+ m.Insert(base.Candidate{
+ Type: base.CandidateTypeColumn,
+ Text: c.quotedIdentifierIfNeeded(column.Name),
+ Definition: definition,
+ Comment: column.Comment,
+ })
+ }
+ continue
+ }
+ // Check materialized views by resolving their definitions.
+ if mvMeta := schemaMeta.GetMaterializedView(table); mvMeta != nil {
+ if columns, err := c.resolveMaterializedViewColumns(mvMeta.GetDefinition(), schema, table); err == nil {
+ for _, col := range columns {
+ m.Insert(col)
+ }
}
- m.Insert(base.Candidate{
- Type: base.CandidateTypeColumn,
- Text: c.quotedIdentifierIfNeeded(column.Name),
- Definition: definition,
- Comment: column.Comment,
- })
}
}
}
@@ -476,6 +481,35 @@ func (m CompletionMap) insertAllColumns(c *Completer) {
})
}
}
+ for _, ft := range schemaMeta.ListForeignTableNames() {
+ extMeta := schemaMeta.GetExternalTable(ft)
+ if extMeta == nil {
+ continue
+ }
+ for _, column := range extMeta.GetProto().GetColumns() {
+ definition := fmt.Sprintf("%s.%s | %s", schema, ft, column.Type)
+ if !column.Nullable {
+ definition += ", NOT NULL"
+ }
+ m.Insert(base.Candidate{
+ Type: base.CandidateTypeColumn,
+ Text: c.quotedIdentifierIfNeeded(column.Name),
+ Definition: definition,
+ Comment: column.Comment,
+ })
+ }
+ }
+ for _, mv := range schemaMeta.ListMaterializedViewNames() {
+ mvMeta := schemaMeta.GetMaterializedView(mv)
+ if mvMeta == nil {
+ continue
+ }
+ if columns, err := c.resolveMaterializedViewColumns(mvMeta.GetDefinition(), schema, mv); err == nil {
+ for _, col := range columns {
+ m.Insert(col)
+ }
+ }
+ }
}
}
@@ -502,7 +536,7 @@ func (m CompletionMap) toSlice() []base.Candidate {
return result
}
-func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]base.Candidate, error) {
+func (c *Completer) convertCandidates(candidates *pgparser.CandidateSet) ([]base.Candidate, error) {
keywordEntries := make(CompletionMap)
runtimeFunctionEntries := make(CompletionMap)
schemaEntries := make(CompletionMap)
@@ -511,59 +545,30 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
viewEntries := make(CompletionMap)
sequenceEntries := make(CompletionMap)
- for token, value := range candidates.Tokens {
- if token < 0 {
+ // Token candidates → keywords.
+ // Skip single-char punctuation/operator tokens (they are not useful keyword completions).
+ for _, tok := range candidates.Tokens {
+ if tok > 0 && tok < 256 {
continue
}
- entry := c.parser.SymbolicNames[token]
- if strings.HasSuffix(entry, "_P") {
- entry = entry[:len(entry)-2]
- } else {
- entry = unquote(entry)
- }
-
- list := 0
- if len(value) > 0 {
- // For function call:
- if value[0] == pg.PostgreSQLLexerOPEN_PAREN {
- list = 1
- } else {
- for _, item := range value {
- subEntry := c.parser.SymbolicNames[item]
- if strings.HasSuffix(subEntry, "_P") {
- subEntry = subEntry[:len(subEntry)-2]
- } else {
- subEntry = unquote(subEntry)
- }
- entry += " " + subEntry
- }
- }
- }
-
- switch list {
- case 1:
- runtimeFunctionEntries.Insert(base.Candidate{
- Type: base.CandidateTypeFunction,
- Text: strings.ToLower(entry) + "()",
- })
- default:
- keywordEntries.Insert(base.Candidate{
- Type: base.CandidateTypeKeyword,
- Text: entry,
- })
+ name := pgparser.TokenName(tok)
+ if name == "" {
+ continue
}
+ keywordEntries.Insert(base.Candidate{
+ Type: base.CandidateTypeKeyword,
+ Text: name,
+ })
}
- for candidate := range candidates.Rules {
- c.scanner.PopAndRestore()
- c.scanner.Push()
-
- c.fetchCommonTableExpression(candidates.Rules[candidate])
+ // Rule candidates → semantic objects
+ for _, rc := range candidates.Rules {
+ c.fetchCommonTableExpression(candidates.CTEPositions)
- switch candidate {
- case pg.PostgreSQLParserRULE_func_name:
+ switch rc.Rule {
+ case "func_name":
runtimeFunctionEntries.insertFunctions()
- case pg.PostgreSQLParserRULE_relation_expr, pg.PostgreSQLParserRULE_qualified_name:
+ case "relation_expr", "qualified_name", "any_name":
qualifier, flags := c.determineQualifiedName()
if flags&ObjectFlagsShowFirst != 0 {
@@ -594,7 +599,7 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
viewEntries.insertViewsWithPrefix(c, schemas, includeSchemaPrefix)
sequenceEntries.insertSequencesWithPrefix(c, schemas, includeSchemaPrefix)
}
- case pg.PostgreSQLParserRULE_columnref:
+ case "columnref":
schema, table, flags := c.determineColumnRef()
if flags&ObjectFlagsShowSchemas != 0 {
schemaEntries.insertSchemas(c)
@@ -693,12 +698,15 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
}
}
} else if len(c.references) > 0 {
- list := c.fetchSelectItemAliases(candidates.Rules[candidate])
- for _, alias := range list {
- columnEntries.Insert(base.Candidate{
- Type: base.CandidateTypeColumn,
- Text: c.quotedIdentifierIfNeeded(alias),
- })
+ // Only suggest SELECT item aliases in ORDER BY / GROUP BY / HAVING.
+ if c.isInAliasAllowedContext() {
+ list := c.fetchSelectItemAliases(candidates.SelectAliasPositions)
+ for _, alias := range list {
+ columnEntries.Insert(base.Candidate{
+ Type: base.CandidateTypeColumn,
+ Text: c.quotedIdentifierIfNeeded(alias),
+ })
+ }
}
for _, reference := range c.references {
switch reference := reference.(type) {
@@ -729,7 +737,6 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
}
}
- c.scanner.PopAndRestore()
var result []base.Candidate
result = append(result, keywordEntries.toSlice()...)
result = append(result, runtimeFunctionEntries.toSlice()...)
@@ -742,14 +749,10 @@ func (c *Completer) convertCandidates(candidates *base.CandidatesCollection) ([]
return result, nil
}
-func (c *Completer) fetchCommonTableExpression(ruleStack []*base.RuleContext) {
+func (c *Completer) fetchCommonTableExpression(ctePositions []int) {
c.cteTables = nil
- for _, rule := range ruleStack {
- if rule.ID == pg.PostgreSQLParserRULE_select_no_parens {
- for _, pos := range rule.CTEList {
- c.cteTables = append(c.cteTables, c.extractCTETables(pos)...)
- }
- }
+ for _, pos := range ctePositions {
+ c.cteTables = append(c.cteTables, c.extractCTETables(pos)...)
}
}
@@ -757,7 +760,10 @@ func (c *Completer) extractCTETables(pos int) []*base.VirtualTableReference {
if metadata, exists := c.cteCache[pos]; exists {
return metadata
}
- followingText := c.scanner.GetFollowingTextAfter(pos)
+ if pos >= len(c.sql) {
+ return nil
+ }
+ followingText := c.sql[pos:]
if len(followingText) == 0 {
return nil
}
@@ -817,39 +823,57 @@ func (l *CTETableListener) EnterCommon_table_expr(ctx *pg.Common_table_exprConte
l.tables = append(l.tables, table)
}
-func (c *Completer) fetchSelectItemAliases(ruleStack []*base.RuleContext) []string {
- canUseAliases := false
- for i := len(ruleStack) - 1; i >= 0; i-- {
- switch ruleStack[i].ID {
- case pg.PostgreSQLParserRULE_simple_select_pramary, pg.PostgreSQLParserRULE_select_no_parens:
- if !canUseAliases {
- return nil
- }
- aliasMap := make(map[string]bool)
- for pos := range ruleStack[i].SelectItemAliases {
- if aliasText := c.extractAliasText(pos); len(aliasText) > 0 {
- aliasMap[aliasText] = true
- }
- }
-
- var result []string
- for alias := range aliasMap {
- result = append(result, alias)
+// isInAliasAllowedContext checks if the caret is in a context where SELECT item
+// aliases are valid completions: ORDER BY, GROUP BY, or HAVING clauses.
+// Aliases are NOT allowed in WHERE, JOIN ON, FROM, or SELECT contexts.
+func (c *Completer) isInAliasAllowedContext() bool {
+ level := 0
+ for i := c.caretTokenIndex - 1; i >= 0; i-- {
+ switch c.tokens[i].Type {
+ case ')':
+ level++
+ case '(':
+ if level > 0 {
+ level--
+ } else {
+ return false // inside a subquery — don't look further
}
- slices.Sort(result)
- return result
- case pg.PostgreSQLParserRULE_opt_sort_clause, pg.PostgreSQLParserRULE_group_clause, pg.PostgreSQLParserRULE_having_clause:
- canUseAliases = true
default:
- // Other cases
+ }
+ if level > 0 {
+ continue // skip tokens inside nested parens
+ }
+ switch c.tokens[i].Type {
+ case pgparser.ORDER, pgparser.GROUP_P, pgparser.HAVING:
+ return true
+ case pgparser.WHERE, pgparser.ON, pgparser.FROM, pgparser.SELECT,
+ pgparser.LIMIT, pgparser.OFFSET, pgparser.WINDOW, pgparser.FOR:
+ return false
}
}
+ return false
+}
- return nil
+func (c *Completer) fetchSelectItemAliases(aliasPositions []int) []string {
+ aliasMap := make(map[string]bool)
+ for _, pos := range aliasPositions {
+ if aliasText := c.extractAliasText(pos); len(aliasText) > 0 {
+ aliasMap[aliasText] = true
+ }
+ }
+ var result []string
+ for alias := range aliasMap {
+ result = append(result, alias)
+ }
+ slices.Sort(result)
+ return result
}
func (c *Completer) extractAliasText(pos int) string {
- followingText := c.scanner.GetFollowingTextAfter(pos)
+ if pos >= len(c.sql) {
+ return ""
+ }
+ followingText := c.sql[pos:]
if len(followingText) == 0 {
return ""
}
@@ -894,100 +918,121 @@ const (
)
func (c *Completer) determineQualifiedName() (string, ObjectFlags) {
- position := c.scanner.GetIndex()
- if c.scanner.GetTokenChannel() != 0 {
- c.scanner.Forward(true /* skipHidden */)
- }
-
- if !c.scanner.IsTokenType(pg.PostgreSQLLexerONLY) && !c.lexer.IsIdentifier(c.scanner.GetTokenType()) {
- // We are at the end of an incomplete identifier spec.
- // Jump back.
- c.scanner.Backward(true /* skipHidden */)
+ // Walk backward from the caret token to find qualifier.identifier pattern.
+ // We look for: [identifier] [.] [identifier_at_caret]
+ idx := c.caretTokenIndex
+
+ // If the caret token is an identifier or ONLY keyword, we're on the trailing identifier.
+ // Otherwise we might be right after the trailing identifier (e.g. after a dot).
+ if idx < len(c.tokens) {
+ tt := c.tokens[idx].Type
+ if tt != pgparser.ONLY && !pgparser.IsIdentifierTokenType(tt) {
+ idx--
+ }
+ } else {
+ idx = len(c.tokens) - 1
}
- // Go left until we hit a non-identifier token.
- if position > 0 {
- if c.lexer.IsIdentifier(c.scanner.GetTokenType()) && c.scanner.GetPreviousTokenType(false /* skipHidden */) == pg.PostgreSQLLexerDOT {
- c.scanner.Backward(true /* skipHidden */)
- }
- if c.scanner.IsTokenType(pg.PostgreSQLLexerDOT) && c.lexer.IsIdentifier(c.scanner.GetPreviousTokenType(false /* skipHidden */)) {
- c.scanner.Backward(true /* skipHidden */)
- }
+ if idx < 0 {
+ return "", ObjectFlagsShowFirst | ObjectFlagsShowSecond
}
- // The current token is on the leading identifier.
- qualifier := ""
- temp := ""
- if c.lexer.IsIdentifier(c.scanner.GetTokenType()) {
- temp = normalizeIdentifier(c.scanner.GetTokenText())
- c.scanner.Forward(true /* skipHidden */)
+ // Check if there's a dot before the current identifier, indicating a qualifier.
+ if idx >= 2 && pgparser.IsIdentifierTokenType(c.tokens[idx].Type) &&
+ c.tokens[idx-1].Type == '.' &&
+ pgparser.IsIdentifierTokenType(c.tokens[idx-2].Type) {
+ qualifier := normalizeIdentifier(c.tokens[idx-2].Str)
+ return qualifier, ObjectFlagsShowSecond
}
- if !c.scanner.IsTokenType(pg.PostgreSQLLexerDOT) || position <= c.scanner.GetIndex() {
- return qualifier, ObjectFlagsShowFirst | ObjectFlagsShowSecond
+ // If caret is right after a dot (e.g. "schema.|"), the dot is at idx
+ if idx >= 1 && c.tokens[idx].Type == '.' &&
+ pgparser.IsIdentifierTokenType(c.tokens[idx-1].Type) {
+ qualifier := normalizeIdentifier(c.tokens[idx-1].Str)
+ return qualifier, ObjectFlagsShowSecond
}
- qualifier = temp
- return qualifier, ObjectFlagsShowSecond
+ return "", ObjectFlagsShowFirst | ObjectFlagsShowSecond
}
func (c *Completer) determineColumnRef() (schema, table string, flags ObjectFlags) {
- position := c.scanner.GetIndex()
- if c.scanner.GetTokenChannel() != 0 {
- c.scanner.Forward(true /* skipHidden */)
+ // Walk backward from the caret token to find schema.table.column pattern.
+ idx := c.caretTokenIndex
+
+ // If the caret token is not a dot and not an identifier, step back.
+ if idx < len(c.tokens) {
+ tt := c.tokens[idx].Type
+ if tt != '.' && !pgparser.IsIdentifierTokenType(tt) {
+ idx--
+ }
+ } else {
+ idx = len(c.tokens) - 1
}
- tokenType := c.scanner.GetTokenType()
- if tokenType != pg.PostgreSQLLexerDOT && !c.lexer.IsIdentifier(c.scanner.GetTokenType()) {
- // We are at the end of an incomplete identifier spec.
- // Jump back.
- c.scanner.Backward(true /* skipHidden */)
+ if idx < 0 {
+ return "", "", ObjectFlagsShowSchemas | ObjectFlagsShowTables | ObjectFlagsShowColumns
}
- if position > 0 {
- if c.lexer.IsIdentifier(c.scanner.GetTokenType()) && c.scanner.GetPreviousTokenType(false /* skipHidden */) == pg.PostgreSQLLexerDOT {
- c.scanner.Backward(true /* skipHidden */)
- }
- if c.scanner.IsTokenType(pg.PostgreSQLLexerDOT) && c.lexer.IsIdentifier(c.scanner.GetPreviousTokenType(false /* skipHidden */)) {
- c.scanner.Backward(true /* skipHidden */)
+ // Walk backward to find the leftmost identifier in a dotted chain.
+ // Possible patterns:
+ // column → show schemas, tables, columns
+ // table.column → show tables, columns
+ // table. → show tables, columns
+ // schema.table.column → show columns
+ // schema.table. → show columns
- if c.scanner.GetPreviousTokenType(false /* skipHidden */) == pg.PostgreSQLLexerDOT {
- c.scanner.Backward(true /* skipHidden */)
- if c.lexer.IsIdentifier(c.scanner.GetPreviousTokenType(false /* skipHidden */)) {
- c.scanner.Backward(true /* skipHidden */)
- }
- }
- }
- }
+ // Collect identifiers and dots backward.
+ parts := []string{} // identifiers found, from right to left
+ pos := idx
- schema = ""
- table = ""
- temp := ""
- if c.lexer.IsIdentifier(c.scanner.GetTokenType()) {
- temp = normalizeIdentifier(c.scanner.GetTokenText())
- c.scanner.Forward(true /* skipHidden */)
+ // If current position is an identifier, collect it and move left.
+ if pos >= 0 && pgparser.IsIdentifierTokenType(c.tokens[pos].Type) {
+ parts = append(parts, normalizeIdentifier(c.tokens[pos].Str))
+ pos--
}
- if !c.scanner.IsTokenType(pg.PostgreSQLLexerDOT) || position <= c.scanner.GetIndex() {
- return schema, table, ObjectFlagsShowSchemas | ObjectFlagsShowTables | ObjectFlagsShowColumns
+ // Check for dot + identifier patterns going left.
+ for pos >= 1 && c.tokens[pos].Type == '.' && pgparser.IsIdentifierTokenType(c.tokens[pos-1].Type) {
+ parts = append(parts, normalizeIdentifier(c.tokens[pos-1].Str))
+ pos -= 2
}
- c.scanner.Forward(true /* skipHidden */) // skip dot
- table = temp
- schema = temp
- if c.lexer.IsIdentifier(c.scanner.GetTokenType()) {
- temp = normalizeIdentifier(c.scanner.GetTokenText())
- c.scanner.Forward(true /* skipHidden */)
-
- if !c.scanner.IsTokenType(pg.PostgreSQLLexerDOT) || position <= c.scanner.GetIndex() {
- return schema, table, ObjectFlagsShowTables | ObjectFlagsShowColumns
+ // Handle trailing dot case: if current token is a dot, the parts collected
+ // so far are qualifiers. E.g. "table." means table is a qualifier.
+ if idx >= 0 && c.tokens[idx].Type == '.' {
+ // The dot is the last token. Parts are everything before the dot.
+ // e.g., for "schema.table." parts = ["table", "schema"]
+ // We treat this as schema=schema, table=table, show columns.
+ switch len(parts) {
+ case 0:
+ // Just a lone dot — shouldn't happen, but treat as no qualifier.
+ return "", "", ObjectFlagsShowSchemas | ObjectFlagsShowTables | ObjectFlagsShowColumns
+ case 1:
+ // "table." → table=parts[0], show tables + columns
+ return parts[0], parts[0], ObjectFlagsShowTables | ObjectFlagsShowColumns
+ default:
+ // "schema.table." → schema=parts[1], table=parts[0], show columns
+ return parts[1], parts[0], ObjectFlagsShowColumns
}
-
- table = temp
- return schema, table, ObjectFlagsShowColumns
}
- return schema, table, ObjectFlagsShowTables | ObjectFlagsShowColumns
+ // Not a trailing dot case. Parts are from the identifier chain (right-to-left).
+ // parts[0] = rightmost (column), parts[1] = next left (table or schema), etc.
+ switch len(parts) {
+ case 0:
+ return "", "", ObjectFlagsShowSchemas | ObjectFlagsShowTables | ObjectFlagsShowColumns
+ case 1:
+ // Single identifier, e.g. "col" → show schemas, tables, columns
+ return "", "", ObjectFlagsShowSchemas | ObjectFlagsShowTables | ObjectFlagsShowColumns
+ case 2:
+ // "table.column" → We don't know yet if parts[1] is a schema or table.
+ // Return schema=table=parts[1] so the downstream code can check aliases
+ // and resolve against both schema and table metadata.
+ return parts[1], parts[1], ObjectFlagsShowTables | ObjectFlagsShowColumns
+ default:
+ // "schema.table.column" → schema=leftmost, table=second from left
+ return parts[len(parts)-1], parts[len(parts)-2], ObjectFlagsShowColumns
+ }
}
func normalizeIdentifier(tokenText string) string {
@@ -1015,85 +1060,40 @@ func (c *Completer) takeReferencesSnapshot() {
}
func (c *Completer) collectRemainingTableReferences() {
- c.scanner.Push()
-
level := 0
- for {
- found := c.scanner.GetTokenType() == pg.PostgreSQLLexerFROM
- for !found {
- if !c.scanner.Forward(false /* skipHidden */) {
- break
+ for i := c.caretTokenIndex; i < len(c.tokens); i++ {
+ switch c.tokens[i].Type {
+ case '(':
+ level++
+ case ')':
+ if level > 0 {
+ level--
}
-
- switch c.scanner.GetTokenType() {
- case pg.PostgreSQLLexerOPEN_PAREN:
- level++
- case pg.PostgreSQLLexerCLOSE_PAREN:
- if level > 0 {
- level--
- }
- case pg.PostgreSQLLexerFROM:
- // Open and close parenthesis don't need to match, if we come from within a subquery.
- if level == 0 {
- found = true
- }
- default:
- // Other tokens, continue scanning
+ case pgparser.FROM:
+ if level == 0 {
+ c.parseTableReferences(c.sql[c.tokens[i].Loc:])
}
- }
-
- if !found {
- c.scanner.PopAndRestore()
- return // No more FROM clauses found.
- }
-
- c.parseTableReferences(c.scanner.GetFollowingText())
- if c.scanner.GetTokenType() == pg.PostgreSQLLexerFROM {
- c.scanner.Forward(false /* skipHidden */)
+ default:
}
}
}
func (c *Completer) collectLeadingTableReferences(caretIndex int) {
- c.scanner.Push()
-
- c.scanner.SeekIndex(0)
-
level := 0
- for {
- found := c.scanner.GetTokenType() == pg.PostgreSQLLexerFROM
- for !found {
- if !c.scanner.Forward(false /* skipHidden */) || c.scanner.GetIndex() >= caretIndex {
- break
- }
-
- switch c.scanner.GetTokenType() {
- case pg.PostgreSQLLexerOPEN_PAREN:
- level++
- c.referencesStack = append([][]base.TableReference{{}}, c.referencesStack...)
- case pg.PostgreSQLLexerCLOSE_PAREN:
- if level == 0 {
- c.scanner.PopAndRestore()
- return // We cannot go above the initial nesting level.
- }
-
- level--
- c.referencesStack = c.referencesStack[1:]
- case pg.PostgreSQLLexerFROM:
- found = true
- default:
- // Other tokens, continue scanning
+ for i := 0; i < len(c.tokens) && i < caretIndex; i++ {
+ switch c.tokens[i].Type {
+ case '(':
+ level++
+ c.referencesStack = append([][]base.TableReference{{}}, c.referencesStack...)
+ case ')':
+ if level == 0 {
+ return // We cannot go above the initial nesting level.
}
- }
-
- if !found {
- c.scanner.PopAndRestore()
- return // No more FROM clauses found.
- }
-
- c.parseTableReferences(c.scanner.GetFollowingText())
- if c.scanner.GetTokenType() == pg.PostgreSQLLexerFROM {
- c.scanner.Forward(false /* skipHidden */)
+ level--
+ c.referencesStack = c.referencesStack[1:]
+ case pgparser.FROM:
+ c.parseTableReferences(c.sql[c.tokens[i].Loc:])
+ default:
}
}
}
@@ -1242,34 +1242,6 @@ func normalizeTableAlias(ctx pg.IOpt_alias_clauseContext) (string, []string) {
return tableAlias, columnAliases
}
-func prepareTrickyParserAndScanner(statement string, caretLine int, caretOffset int) (*pg.PostgreSQLParser, *pg.PostgreSQLLexer, *base.Scanner) {
- statement, caretLine, caretOffset = skipHeadingSQLs(statement, caretLine, caretOffset)
- statement, caretLine, caretOffset = skipHeadingSQLWithoutSemicolon(statement, caretLine, caretOffset)
- input := antlr.NewInputStream(statement)
- lexer := pg.NewPostgreSQLLexer(input)
- stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)
- parser := pg.NewPostgreSQLParser(stream)
- parser.RemoveErrorListeners()
- lexer.RemoveErrorListeners()
- scanner := base.NewScanner(stream, true /* fillInput */)
- scanner.SeekPosition(caretLine, caretOffset)
- scanner.Push()
- return parser, lexer, scanner
-}
-
-func prepareParserAndScanner(statement string, caretLine int, caretOffset int) (*pg.PostgreSQLParser, *pg.PostgreSQLLexer, *base.Scanner) {
- statement, caretLine, caretOffset = skipHeadingSQLs(statement, caretLine, caretOffset)
- input := antlr.NewInputStream(statement)
- lexer := pg.NewPostgreSQLLexer(input)
- stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)
- parser := pg.NewPostgreSQLParser(stream)
- parser.RemoveErrorListeners()
- lexer.RemoveErrorListeners()
- scanner := base.NewScanner(stream, true /* fillInput */)
- scanner.SeekPosition(caretLine, caretOffset)
- scanner.Push()
- return parser, lexer, scanner
-}
// caretLine is 1-based and caretOffset is 0-based.
func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string, int, int) {
@@ -1318,34 +1290,43 @@ func skipHeadingSQLs(statement string, caretLine int, caretOffset int) (string,
// caretLine is 1-based and caretOffset is 0-based.
func skipHeadingSQLWithoutSemicolon(statement string, caretLine int, caretOffset int) (string, int, int) {
- input := antlr.NewInputStream(statement)
- lexer := pg.NewPostgreSQLLexer(input)
- stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)
- lexer.RemoveErrorListeners()
- lexerErrorListener := &base.ParseErrorListener{
- Statement: statement,
- }
- lexer.AddErrorListener(lexerErrorListener)
+ tokens := pgparser.Tokenize(statement)
+ caretByteOff := lineColumnToByteOffset(statement, caretLine, caretOffset)
- stream.Fill()
- tokens := stream.GetAllTokens()
- latestSelect := 0
+ latestSelectOffset := -1
+ latestSelectLine := 0
newCaretLine, newCaretOffset := caretLine, caretOffset
- for _, token := range tokens {
- if token.GetLine() > caretLine || (token.GetLine() == caretLine && token.GetColumn() >= caretOffset) {
+
+ for _, tok := range tokens {
+ if tok.Loc >= caretByteOff {
break
}
- if token.GetTokenType() == pg.PostgreSQLLexerSELECT && token.GetColumn() == 0 {
- latestSelect = token.GetTokenIndex()
- newCaretLine = caretLine - token.GetLine() + 1 // convert to 1-based.
- newCaretOffset = caretOffset
+ if tok.Type == pgparser.SELECT {
+ // Check that this SELECT starts at column 0 of its line.
+ // Either it's the first byte of the string, or the byte immediately
+ // before it is a newline.
+ atColumn0 := tok.Loc == 0 || statement[tok.Loc-1] == '\n'
+ if atColumn0 {
+ latestSelectOffset = tok.Loc
+ // Compute the line number of this token.
+ line := 1
+ for j := 0; j < tok.Loc; j++ {
+ if statement[j] == '\n' {
+ line++
+ }
+ }
+ latestSelectLine = line
+ newCaretLine = caretLine - latestSelectLine + 1
+ newCaretOffset = caretOffset
+ }
}
}
- if latestSelect == 0 {
+ if latestSelectOffset < 0 {
return statement, caretLine, caretOffset
}
- return stream.GetTextFromInterval(antlr.NewInterval(latestSelect, stream.Size())), newCaretLine, newCaretOffset
+
+ return statement[latestSelectOffset:], newCaretLine, newCaretOffset
}
func (c *Completer) listAllSchemas() []string {
@@ -1408,6 +1389,36 @@ func (c *Completer) listMaterializedViews(schema string) []string {
return schemaMeta.ListMaterializedViewNames()
}
+func (c *Completer) resolveMaterializedViewColumns(definition, schema, table string) ([]base.Candidate, error) {
+ if len(definition) == 0 {
+ return nil, nil
+ }
+ span, err := GetQuerySpan(
+ c.ctx,
+ base.GetQuerySpanContext{
+ InstanceID: c.instanceID,
+ GetDatabaseMetadataFunc: c.getMetadata,
+ ListDatabaseNamesFunc: c.listDatabaseNames,
+ },
+ base.Statement{Text: definition + ";"},
+ c.defaultDatabase,
+ "",
+ false,
+ )
+ if err != nil || span.NotFoundError != nil {
+ return nil, err
+ }
+ var candidates []base.Candidate
+ for _, col := range span.Results {
+ candidates = append(candidates, base.Candidate{
+ Type: base.CandidateTypeColumn,
+ Text: c.quotedIdentifierIfNeeded(col.Name),
+ Definition: fmt.Sprintf("%s.%s", schema, table),
+ })
+ }
+ return candidates, nil
+}
+
func (c *Completer) listViews(schema string) []string {
if _, exists := c.metadataCache[c.defaultDatabase]; !exists {
_, metadata, err := c.getMetadata(c.ctx, c.instanceID, c.defaultDatabase)
@@ -1447,7 +1458,7 @@ func (c *Completer) quotedIdentifierIfNeeded(s string) string {
if strings.ToLower(s) != s {
return fmt.Sprintf(`"%s"`, s)
}
- if c.lexer.IsReservedKeyword(strings.ToUpper(s)) {
+ if pgparser.IsReservedKeyword(strings.ToUpper(s)) {
return fmt.Sprintf(`"%s"`, s)
}
// PostgreSQL requires double quotes for identifiers with special characters or start with digits
diff --git a/backend/plugin/parser/pg/completion_test.go b/backend/plugin/parser/pg/completion_test.go
index 4216083ce5..491bca257d 100644
--- a/backend/plugin/parser/pg/completion_test.go
+++ b/backend/plugin/parser/pg/completion_test.go
@@ -140,6 +140,27 @@ func getMetadataForTest(_ context.Context, _, databaseName string) (string, *mod
`,
},
},
+ ExternalTables: []*storepb.ExternalTableMetadata{
+ {
+ Name: "ft1",
+ Columns: []*storepb.ColumnMetadata{
+ {
+ Name: "f1",
+ Type: "int",
+ },
+ {
+ Name: "f2",
+ Type: "varchar",
+ },
+ },
+ },
+ },
+ MaterializedViews: []*storepb.MaterializedViewMetadata{
+ {
+ Name: "mv1",
+ Definition: "SELECT c1, c2 FROM t2",
+ },
+ },
Sequences: []*storepb.SequenceMetadata{
{
Name: "seq1",
@@ -189,6 +210,140 @@ func getMetadataForTest(_ context.Context, _, databaseName string) (string, *mod
}, nil, nil, storepb.Engine_POSTGRES, true /* isObjectCaseSensitive */), nil
}
+func TestCompletionQuotedIdentifiers(t *testing.T) {
+ tests := []candidatesTest{}
+
+ const (
+ record = false
+ )
+ var (
+ filepath = "test-data/test_completion_quoted_identifiers.yaml"
+ )
+
+ a := require.New(t)
+ yamlFile, err := os.Open(filepath)
+ a.NoError(err)
+
+ byteValue, err := io.ReadAll(yamlFile)
+ a.NoError(yamlFile.Close())
+ a.NoError(err)
+ a.NoError(yaml.Unmarshal(byteValue, &tests))
+
+ for i, t := range tests {
+ text, caretOffset := catchCaret(t.Input)
+ result, err := base.Completion(context.Background(), storepb.Engine_POSTGRES, base.CompletionContext{
+ Scene: base.SceneTypeAll,
+ DefaultDatabase: "db",
+ Metadata: getQuotedIdentifierMetadataForTest,
+ ListDatabaseNames: listDatbaseNamesForTest,
+ }, text, 1, caretOffset)
+ a.NoError(err)
+ var filteredResult []base.Candidate
+ for _, r := range result {
+ switch r.Type {
+ case base.CandidateTypeKeyword, base.CandidateTypeFunction:
+ continue
+ default:
+ filteredResult = append(filteredResult, r)
+ }
+ }
+ slices.SortFunc(filteredResult, func(x, y base.Candidate) int {
+ if x.Type != y.Type {
+ if x.Type < y.Type {
+ return -1
+ }
+ return 1
+ }
+ if x.Text != y.Text {
+ if x.Text < y.Text {
+ return -1
+ }
+ return 1
+ }
+ if x.Definition < y.Definition {
+ return -1
+ } else if x.Definition > y.Definition {
+ return 1
+ }
+ return 0
+ })
+
+ if record {
+ tests[i].Want = filteredResult
+ } else {
+ a.Equal(t.Want, filteredResult, t.Input)
+ }
+ }
+
+ if record {
+ byteValue, err := yaml.Marshal(tests)
+ a.NoError(err)
+ err = os.WriteFile(filepath, byteValue, 0644)
+ a.NoError(err)
+ }
+}
+
+func getQuotedIdentifierMetadataForTest(_ context.Context, _, databaseName string) (string, *model.DatabaseMetadata, error) {
+ if databaseName != "db" {
+ return "", nil, nil
+ }
+
+ return "db", model.NewDatabaseMetadata(&storepb.DatabaseSchemaMetadata{
+ Name: databaseName,
+ Schemas: []*storepb.SchemaMetadata{
+ {
+ Name: "public",
+ Tables: []*storepb.TableMetadata{
+ {
+ Name: "t1",
+ Columns: []*storepb.ColumnMetadata{
+ {
+ Name: "c1",
+ Type: "int",
+ },
+ },
+ },
+ {
+ Name: "order",
+ Columns: []*storepb.ColumnMetadata{
+ {
+ Name: "id",
+ Type: "int",
+ },
+ {
+ Name: "amount",
+ Type: "numeric",
+ },
+ },
+ },
+ {
+ Name: "MyTable",
+ Columns: []*storepb.ColumnMetadata{
+ {
+ Name: "Id",
+ Type: "int",
+ },
+ {
+ Name: "Value",
+ Type: "text",
+ },
+ },
+ },
+ {
+ Name: "my-table",
+ Columns: []*storepb.ColumnMetadata{
+ {
+ Name: "col1",
+ Type: "int",
+ },
+ },
+ },
+ },
+ },
+ },
+ }, nil, nil, storepb.Engine_POSTGRES, true /* isObjectCaseSensitive */), nil
+}
+
func catchCaret(s string) (string, int) {
for i, c := range s {
if c == '|' {
diff --git a/backend/plugin/parser/pg/test-data/test_completion.yaml b/backend/plugin/parser/pg/test-data/test_completion.yaml
index f5060aec50..d0701b8e22 100644
--- a/backend/plugin/parser/pg/test-data/test_completion.yaml
+++ b/backend/plugin/parser/pg/test-data/test_completion.yaml
@@ -1,489 +1,10940 @@
+- input: SELECT * FROM |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM test.|
+ want:
+ - text: order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 x
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM public.t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM test.auto
+ want:
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT t1.| FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT cc1.| FROM t2 cc1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT cc1.| FROM t1 cc1 JOIN t2 on NOT cc1.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT public.t2.| FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 JOIN t2 ON t1.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 cc1 JOIN t2 ON cc1.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 cc1 JOIN t2 ON cc1.c1 = t2.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT a.| FROM t1 a JOIN t1 b ON a.c1 = b.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT b.| FROM t1 a JOIN t1 b ON a.c1 = b.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 LEFT JOIN t2 ON t1.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 a JOIN t2 b ON a.c1 = b.c1 JOIN test.auto c ON b.c1 = c.id
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: a
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: b
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c.| FROM t1 a JOIN t2 b ON a.c1 = b.c1 JOIN test.auto c ON b.c1 = c.id
+ want:
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM (SELECT c1 FROM t1) cc1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: cc1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT x.| FROM (SELECT * FROM t2) x
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM (SELECT * FROM (SELECT c1 FROM t1) inner_q) outer_q
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: outer_q
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM (SELECT c1 FROM t1) sub1 JOIN t2 ON sub1.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: sub1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT * FROM t2) SELECT x.| FROM x;
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x(x1, x2) AS (SELECT * FROM t2) SELECT x.| FROM x;
+ want:
+ - text: x1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x(x1, x2) AS (SELECT * FROM t2) SELECT | FROM x
+ want:
+ - text: x1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH a AS (SELECT c1 FROM t1), b AS (SELECT c1, c2 FROM t2) SELECT | FROM a JOIN b ON a.c1 = b.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: a
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: b
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH a AS (SELECT c1 FROM t1), b AS (SELECT c1, c2 FROM t2) SELECT b.| FROM a JOIN b ON a.c1 = b.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT c1 FROM t1) SELECT | FROM (SELECT * FROM x) sub1
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: sub1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM test.auto WHERE |
+ want:
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM test.auto WHERE test.auto.|
+ want:
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT c1 as eid FROM t1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 a JOIN t2 b ON a.c1 = b.c1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: a
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: b
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 a JOIN t2 b ON a.c1 = b.c1 WHERE a.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE c1 IN (SELECT | FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE EXISTS (SELECT | FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 = 1 AND |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE (c1 = 1 AND |)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 as eid FROM t1 ORDER BY |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: eid
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 as eid, c2 as xid FROM t2 ORDER BY |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: eid
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: xid
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 as eid FROM t1 GROUP BY |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: eid
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 as eid, c2 as xid FROM t2 HAVING |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: eid
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: xid
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 x ORDER BY x.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 x GROUP BY x.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT MAX(cc1.|) FROM t2 cc1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT COUNT(|) FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: INSERT INTO |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: INSERT INTO test.| VALUES (1)
+ want:
+ - text: order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: INSERT INTO t1 (|) VALUES (1)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: INSERT INTO t1 SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE test.|
+ want:
+ - text: order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE t1 SET |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE t1 SET c1 = |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE t1 SET c1 = 1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DELETE FROM |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DELETE FROM test.|
+ want:
+ - text: order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DELETE FROM t1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT 1;SELECT * FROM |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT FROM basdkfjasldf;SELECT | FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
- input: |-
select count(1) from t1 where id; SELECT * FROM |
select * from QRTZ_J0B_DETAILS qjd where J0B_NAME like '%gray';
want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 UNION SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 UNION ALL SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM v1
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 JOIN test.auto ON t1.c1 = test.auto.id
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM (SELECT c1 FROM (SELECT c1 FROM (SELECT c1 FROM t1) a) b) c
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 JOIN test.auto a ON t1.c1 = a.id WHERE a.|
+ want:
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 RIGHT JOIN t2 ON t1.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 FULL OUTER JOIN t2 ON t1.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 CROSS JOIN t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 NATURAL JOIN t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 = t2.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 FULL OUTER JOIN t2 ON t1.c1 = t2.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 CROSS JOIN t2 WHERE t1.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 JOIN t2 USING (|)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 JOIN t2 ON t1.c1 = t2.c1 LEFT JOIN test.auto ON t2.c1 = test.auto.id
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT a.| FROM t1 a NATURAL JOIN t2 b
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 BETWEEN | AND c2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 BETWEEN c2 AND |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM test.auto WHERE name LIKE |
+ want:
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 IS NOT NULL AND |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 IS NULL OR |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE NOT |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 > |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 + | > 0
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE c1 IN (1, 2) AND |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE c1 = (SELECT MAX(|) FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 x WHERE x.c1 IN (SELECT c1 FROM t2 WHERE |)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 WHERE CASE WHEN c1 > 0 THEN | END = 1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT DISTINCT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT DISTINCT ON (|) c1, c2 FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t2 LIMIT 10
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 LIMIT |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 OFFSET |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 ORDER BY c1 LIMIT |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1, | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DELETE FROM t2 WHERE c1 > 0 RETURNING |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE t2 SET c1 = 1 RETURNING |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1, SUM(c2) OVER (PARTITION BY |) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1, SUM(c2) OVER (ORDER BY |) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1, ROW_NUMBER() OVER (PARTITION BY | ORDER BY c1) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT COALESCE(|, 0) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT COALESCE(c1, |) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT NULLIF(|, 0) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT CAST(| AS int) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t2 FOR UPDATE
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM ft1 WHERE |
+ want:
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM mv1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM public.ft1 WHERE |
+ want:
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM public.mv1 WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT ft1.| FROM ft1
+ want:
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM ft1
+ want:
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT mv1.| FROM mv1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+- input: SELECT | FROM mv1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: INSERT INTO |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE | SET c1 = 1
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TABLE test_tbl (id int, FOREIGN KEY (id) REFERENCES |)
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TABLE test_tbl (id int, FOREIGN KEY (id) REFERENCES public.|)
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TABLE test_tbl (id int REFERENCES |)
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TABLE test_tbl (id int REFERENCES t1(|))
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE INDEX idx ON |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE INDEX idx ON public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE INDEX idx ON t1 (|)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE INDEX idx ON t2 (c1, |)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE VIEW v2 AS SELECT | FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE VIEW v2 AS SELECT * FROM |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE MATERIALIZED VIEW mv AS SELECT | FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TABLE test_tbl AS SELECT | FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TABLE test_tbl (LIKE |)
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TRIGGER trig AFTER INSERT ON |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: CREATE TRIGGER trig AFTER INSERT ON public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 ADD COLUMN c2 int REFERENCES |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 DROP COLUMN |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 RENAME COLUMN | TO new_name
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 ALTER COLUMN |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 ALTER COLUMN | SET NOT NULL
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (|) REFERENCES t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (c1) REFERENCES t2(|)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER INDEX | RENAME TO new_name
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER VIEW |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER VIEW public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER SEQUENCE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER SEQUENCE public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: ALTER MATERIALIZED VIEW |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP TABLE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP TABLE public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP TABLE IF EXISTS |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP VIEW |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP VIEW public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP INDEX |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP SEQUENCE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DROP MATERIALIZED VIEW |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: TRUNCATE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: TRUNCATE public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: COMMENT ON TABLE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: COMMENT ON TABLE public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: COMMENT ON COLUMN t1.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: COMMENT ON COLUMN public.t1.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: GRANT SELECT ON |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: GRANT SELECT ON public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: GRANT ALL ON ALL TABLES IN SCHEMA |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: REVOKE SELECT ON |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: REVOKE SELECT ON public.|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: GRANT USAGE ON SEQUENCE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH RECURSIVE x AS (SELECT c1 FROM t1 UNION ALL SELECT | FROM x JOIN t1 ON x.c1 = t1.c1) SELECT * FROM x
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH RECURSIVE x AS (SELECT c1 FROM t1 UNION ALL SELECT x.| FROM x JOIN t1 ON x.c1 = t1.c1) SELECT * FROM x
+ want:
+- input: WITH x AS (SELECT * FROM t2) INSERT INTO t1 SELECT | FROM x
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT c1, c2 FROM t2) UPDATE t1 SET c1 = (SELECT | FROM x)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT * FROM t2) DELETE FROM t1 WHERE c1 IN (SELECT | FROM x)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH a AS (SELECT c1 FROM t1), b AS (SELECT * FROM a) SELECT | FROM b
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: a
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: b
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH a AS (SELECT c1 FROM t1), b AS (SELECT a.| FROM a) SELECT * FROM b
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT c1 FROM t1) SELECT | FROM x, t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT c1 FROM t1) SELECT x.| FROM x JOIN t2 ON x.c1 = t2.c1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x(a, b) AS (SELECT c1, c2 FROM t2) SELECT | FROM x JOIN t1 ON x.a = t1.c1
+ want:
+ - text: a
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: b
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1, LATERAL (SELECT | FROM t2 WHERE t2.c1 = t1.c1) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: sub
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT sub.| FROM t1, LATERAL (SELECT c1, c2 FROM t2 WHERE t2.c1 = t1.c1) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t1 LEFT JOIN LATERAL (SELECT * FROM t2 WHERE t2.c1 = t1.c1) sub ON true
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: sub
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1, LATERAL (SELECT t1.| FROM t2) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t2 x, LATERAL (SELECT x.| FROM t1) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM generate_series(1, 10) g
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.mv1
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f1
+ type: COLUMN
+ definition: public.ft1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: f2
+ type: COLUMN
+ definition: public.ft1 | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: test.auto | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: name
+ type: COLUMN
+ definition: test.auto | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: user_id
+ type: COLUMN
+ definition: test.users | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: username
+ type: COLUMN
+ definition: test.users | varchar, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT g.| FROM generate_series(1, 10) g
+ want:
+- input: SELECT | FROM t1, generate_series(1, 10) g
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t2 x, LATERAL (SELECT * FROM t1 WHERE t1.c1 = x.c1) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: sub
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: x
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT (SELECT | FROM t1) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT (SELECT t1.| FROM t1) FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE c1 = ANY(SELECT | FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE c1 = ALL(SELECT | FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE c1 > (SELECT MAX(|) FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM (SELECT * FROM (SELECT | FROM t1) a) b
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: a
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: b
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT b.| FROM (SELECT * FROM (SELECT c1 FROM t1) a) b
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE EXISTS (SELECT 1 FROM t2 WHERE t2.c1 = t1.|)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM (SELECT c1, c2 FROM t2 UNION SELECT c1, c2 FROM t2) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: sub
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT sub.| FROM (SELECT c1, c2 FROM t2 UNION SELECT c1, c2 FROM t2) sub
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 INTERSECT SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 EXCEPT SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 UNION SELECT c1 FROM t1 UNION SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: (SELECT c1 FROM t1) UNION (SELECT | FROM t2)
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 UNION ALL SELECT c1 FROM t2 ORDER BY |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM (SELECT c1 FROM t1 UNION SELECT c1 FROM t2) x WHERE x.|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: WITH x AS (SELECT c1 FROM t1 UNION SELECT c1 FROM t2) SELECT x.| FROM x
+ want:
+ - text: c1
+ type: COLUMN
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 EXCEPT ALL SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT c1 FROM t1 INTERSECT ALL SELECT | FROM t2
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM t2 UNION SELECT * FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c1
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM "t1"
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT "t1".| FROM t1
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM "public".|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM public."t1" WHERE |
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM public.t|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT t1.c|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT * FROM test.a|
+ want:
+ - text: order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM tes|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 WHERE t1.c|
+ want:
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: INSERT INTO t|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: UPDATE t|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: DELETE FROM t|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM t1 JOIN t|
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT 1; INSERT INTO |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT 1; UPDATE |
+ want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: seq1
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: test.order_id_seq
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: user_id_seq
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: test.auto
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: test.users
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT x.| FROM (SELECT * FROM t2) x
+ priority: 0
+- input: SELECT 1; DELETE FROM |
want:
- - text: c1
- type: COLUMN
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
- - text: c2
- type: COLUMN
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
definition: ""
comment: ""
-- input: WITH x AS (SELECT * FROM t2) SELECT x.| FROM x;
- want:
- - text: c1
- type: COLUMN
+ priority: 0
+ - text: public
+ type: SCHEMA
definition: ""
comment: ""
- - text: c2
- type: COLUMN
+ priority: 0
+ - text: test
+ type: SCHEMA
definition: ""
comment: ""
-- input: WITH x(x1, x2) AS (SELECT * FROM t2) SELECT x.| FROM x;
- want:
- - text: x1
- type: COLUMN
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
definition: ""
comment: ""
- - text: x2
- type: COLUMN
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
definition: ""
comment: ""
-- input: WITH x(x1, x2) AS (SELECT * FROM t2) SELECT | FROM x
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: INVALID SQL; SELECT * FROM |
want:
- - text: x1
- type: COLUMN
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
- - text: x2
- type: COLUMN
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
definition: ""
comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
- - text: x
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT c1 as eid, c2 as xid FROM t2 ORDER BY |
+ priority: 0
+- input: SELECT * FROM t1; SELECT * FROM t2 WHERE |
want:
- text: c1
type: COLUMN
definition: public.t2 | int, NOT NULL
comment: ""
+ priority: 0
- text: c2
type: COLUMN
definition: public.t2 | int, NOT NULL
comment: ""
- - text: eid
- type: COLUMN
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
- - text: xid
- type: COLUMN
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
definition: ""
comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT c1 as eid FROM t1 ORDER BY |
+ priority: 0
+- input: SELECT; SELECT | FROM t1
want:
- text: c1
type: COLUMN
definition: public.t1 | int, NOT NULL
comment: ""
- - text: eid
- type: COLUMN
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT FROM basdkfjasldf;SELECT | FROM t1
+ priority: 0
+- input: SELECT * FROM t1 WHERE; SELECT | FROM t2
want:
- text: c1
type: COLUMN
- definition: public.t1 | int, NOT NULL
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: c2
+ type: COLUMN
+ definition: public.t2 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT | FROM (SELECT c1 FROM t1) cc1
+ priority: 0
+- input: CREATE TABLE x (id int); SELECT | FROM t1
want:
- text: c1
type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
- - text: cc1
- type: TABLE
- definition: ""
- comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT cc1.| FROM t1 cc1 JOIN t2 on NOT cc1.c1 = t2.c1
+ priority: 0
+- input: |-
+ SELECT
+ |
+ FROM t1
want:
- text: c1
type: COLUMN
definition: public.t1 | int, NOT NULL
comment: ""
-- input: SELECT * from t1 cc1 JOIN t2 on cc1.c1 = t2.|
- want:
- - text: c1
- type: COLUMN
- definition: public.t2 | int, NOT NULL
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
comment: ""
- - text: c2
- type: COLUMN
- definition: public.t2 | int, NOT NULL
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
comment: ""
-- input: SELECT * from t1 cc1 JOIN t2 on cc1.|
- want:
- - text: c1
- type: COLUMN
- definition: public.t1 | int, NOT NULL
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
comment: ""
-- input: SELECT MAX(cc1.|) FROM t2 cc1
- want:
- - text: c1
- type: COLUMN
- definition: public.t2 | int, NOT NULL
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
comment: ""
- - text: c2
- type: COLUMN
- definition: public.t2 | int, NOT NULL
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
comment: ""
-- input: SELECT cc1.| FROM t2 cc1
- want:
- - text: c1
- type: COLUMN
- definition: public.t2 | int, NOT NULL
+ priority: 0
+ - text: t2
+ type: TABLE
+ definition: ""
comment: ""
- - text: c2
- type: COLUMN
- definition: public.t2 | int, NOT NULL
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
comment: ""
-- input: SELECT * FROM |
+ priority: 0
+- input: |-
+ SELECT *
+ FROM
+ |
want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: seq1
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: test.order_id_seq
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: user_id_seq
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: test.auto
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: test.users
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT | FROM t1 x
+ priority: 0
+- input: "SELECT\t|\tFROM t1"
want:
- text: c1
type: COLUMN
definition: public.t1 | int, NOT NULL
comment: ""
- - text: public
- type: SCHEMA
- definition: ""
- comment: ""
- - text: test
- type: SCHEMA
- definition: ""
- comment: ""
- - text: t1
- type: TABLE
- definition: ""
- comment: ""
- - text: t2
- type: TABLE
- definition: ""
- comment: ""
- - text: x
- type: TABLE
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
- - text: v1
- type: VIEW
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
definition: ""
comment: ""
-- input: SELECT | FROM public.t1
- want:
- - text: c1
- type: COLUMN
- definition: public.t1 | int, NOT NULL
- comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT * FROM |
+ priority: 0
+- input: SELECT * FROM |
want:
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: seq1
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: test.order_id_seq
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: user_id_seq
type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: test.auto
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: test.users
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-- input: SELECT * FROM test.|
+ priority: 0
+- input: 'SELECT * FROM t1 WHERE | '
want:
- - text: order_id_seq
- type: SEQUENCE
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
- - text: auto
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
type: TABLE
definition: ""
comment: ""
- - text: users
+ priority: 0
+ - text: t2
type: TABLE
definition: ""
comment: ""
-- input: SELECT * FROM test.auto WHERE |
+ priority: 0
+ - text: v1
+ type: VIEW
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT * FROM /* comment */ |
want:
- - text: id
- type: COLUMN
- definition: test.auto | int, NOT NULL
+ - text: ft1
+ type: FOREIGNTABLE
+ definition: ""
comment: ""
- - text: name
- type: COLUMN
- definition: test.auto | varchar, NOT NULL
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
comment: ""
+ priority: 0
- text: public
type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: test
type: SCHEMA
definition: ""
comment: ""
- - text: auto
- type: TABLE
+ priority: 0
+ - text: seq1
+ type: SEQUENCE
definition: ""
comment: ""
+ priority: 0
+ - text: test.order_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: user_id_seq
+ type: SEQUENCE
+ definition: ""
+ comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
- - text: users
+ priority: 0
+ - text: test.auto
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test.users
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
-# Sequence-specific tests
-- input: SELECT * FROM public.|
+ priority: 0
+- input: |-
+ SELECT * FROM t1 -- comment
+ WHERE |
want:
- - text: seq1
- type: SEQUENCE
+ - text: c1
+ type: COLUMN
+ definition: public.t1 | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: ft1
+ type: FOREIGNTABLE
definition: ""
comment: ""
- - text: user_id_seq
- type: SEQUENCE
+ priority: 0
+ - text: mv1
+ type: MATERIALIZEDVIEW
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: test
+ type: SCHEMA
definition: ""
comment: ""
+ priority: 0
- text: t1
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: t2
type: TABLE
definition: ""
comment: ""
+ priority: 0
- text: v1
type: VIEW
definition: ""
comment: ""
+ priority: 0
diff --git a/backend/plugin/parser/pg/test-data/test_completion_quoted_identifiers.yaml b/backend/plugin/parser/pg/test-data/test_completion_quoted_identifiers.yaml
new file mode 100644
index 0000000000..9de645c343
--- /dev/null
+++ b/backend/plugin/parser/pg/test-data/test_completion_quoted_identifiers.yaml
@@ -0,0 +1,113 @@
+- input: SELECT * FROM |
+ want:
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"MyTable"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"my-table"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"order"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT | FROM "order"
+ want:
+ - text: amount
+ type: COLUMN
+ definition: public.order | numeric, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: public.order | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"MyTable"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"my-table"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"order"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+- input: SELECT "order".| FROM "order"
+ want:
+ - text: amount
+ type: COLUMN
+ definition: public.order | numeric, NOT NULL
+ comment: ""
+ priority: 0
+ - text: id
+ type: COLUMN
+ definition: public.order | int, NOT NULL
+ comment: ""
+ priority: 0
+- input: SELECT | FROM "MyTable"
+ want:
+ - text: '"Id"'
+ type: COLUMN
+ definition: public.MyTable | int, NOT NULL
+ comment: ""
+ priority: 0
+ - text: '"Value"'
+ type: COLUMN
+ definition: public.MyTable | text, NOT NULL
+ comment: ""
+ priority: 0
+ - text: public
+ type: SCHEMA
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"MyTable"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"my-table"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: '"order"'
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
+ - text: t1
+ type: TABLE
+ definition: ""
+ comment: ""
+ priority: 0
diff --git a/go.mod b/go.mod
index 83cbd9f9f1..0e485a28f0 100644
--- a/go.mod
+++ b/go.mod
@@ -34,7 +34,7 @@ require (
github.com/bmatcuk/doublestar/v4 v4.10.0
github.com/bytebase/gomongo v0.0.0-20260211083148-d2ea344b4b65
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0
- github.com/bytebase/omni v0.0.0-20260320071625-9e14087f53a2
+ github.com/bytebase/omni v0.0.0-20260320111558-ef957ff3b59c
github.com/caarlos0/env/v11 v11.4.0
github.com/cenkalti/backoff/v5 v5.0.3
github.com/cockroachdb/cockroachdb-parser v0.25.2
diff --git a/go.sum b/go.sum
index a220223caf..c6042468f0 100644
--- a/go.sum
+++ b/go.sum
@@ -253,8 +253,8 @@ github.com/bytebase/gomongo v0.0.0-20260211083148-d2ea344b4b65 h1:RvViQx0e24DeDJ
github.com/bytebase/gomongo v0.0.0-20260211083148-d2ea344b4b65/go.mod h1:4dDI0RO2BK9/BD4VE+YqvlCj/qoVMquZ99QZdRlT8Wg=
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0 h1:bJ8NSf2K+pccl5m/wuu97fiYjDwpJH6IzURAq/3XA2U=
github.com/bytebase/lsp-protocol v0.0.0-20250324071136-1586d0c10ff0/go.mod h1:BEWMfiZtqshdmulKJcIsWb45MUaEvDO4CROcgi8dfFg=
-github.com/bytebase/omni v0.0.0-20260320071625-9e14087f53a2 h1:m9Z3pHBovncCKG4vn190DdAXbXZrfHStkDm/5hgq2ow=
-github.com/bytebase/omni v0.0.0-20260320071625-9e14087f53a2/go.mod h1:btZOCeNcueZehdqT+7YsLSVm+srVGSoPZYvFlITO2Z8=
+github.com/bytebase/omni v0.0.0-20260320111558-ef957ff3b59c h1:XHWlhrB4hVnDY4OY3pU0dwjHQJFkXuoWrzyDGjVpmiE=
+github.com/bytebase/omni v0.0.0-20260320111558-ef957ff3b59c/go.mod h1:btZOCeNcueZehdqT+7YsLSVm+srVGSoPZYvFlITO2Z8=
github.com/bytebase/parser v0.0.0-20260318084752-6c474df57697 h1:/WgqQxX/gLsHS1WOx1rs5M/8kE9ecQAsgnQmlSr7p3c=
github.com/bytebase/parser v0.0.0-20260318084752-6c474df57697/go.mod h1:jeak/EfutSOAuWKvrFIT2IZunhWprM7oTFBRgZ9RCxo=
github.com/bytebase/pgx/v5 v5.0.0-20250212161523-96ff8aed8767 h1:YuR5G3LcxpO5ScSTA+Kdirxg9RW4TRc/v1t7N2Hfmbw=