Skip to content

Commit b11cdce

Browse files
Bump sqlfluff version
1 parent 067933d commit b11cdce

File tree

3 files changed

+100
-92
lines changed

3 files changed

+100
-92
lines changed

build/Dockerfile.lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master
1111
# Install sqlfluff
1212
RUN pip install wheel # It complains if we attempt to install this in the same command as Cython
1313
RUN pip install "Cython<3.0" pyyaml --no-build-isolation # Fix for https://github.com/yaml/pyyaml/issues/601
14-
RUN pip install "sqlfluff==2.1.2"
14+
RUN pip install "sqlfluff==3.3.0"
1515

1616
WORKDIR /pg-schema-diff
1717
COPY . .

internal/queries/queries.sql

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ WHERE
1717

1818
-- name: GetTables :many
1919
SELECT
20-
c.oid AS oid,
20+
c.oid,
2121
c.relname::TEXT AS table_name,
2222
table_namespace.nspname::TEXT AS table_schema_name,
2323
c.relreplident::TEXT AS replica_identity,
@@ -40,7 +40,7 @@ INNER JOIN
4040
ON c.relnamespace = table_namespace.oid
4141
LEFT JOIN
4242
pg_catalog.pg_inherits AS table_inherits
43-
ON table_inherits.inhrelid = c.oid
43+
ON c.oid = table_inherits.inhrelid
4444
LEFT JOIN
4545
pg_catalog.pg_class AS parent_c
4646
ON table_inherits.inhparent = parent_c.oid
@@ -98,16 +98,16 @@ SELECT
9898
FROM pg_catalog.pg_attribute AS a
9999
LEFT JOIN
100100
pg_catalog.pg_attrdef AS d
101-
ON (d.adrelid = a.attrelid AND d.adnum = a.attnum)
102-
LEFT JOIN pg_catalog.pg_collation AS coll ON coll.oid = a.attcollation
101+
ON (a.attrelid = d.adrelid AND a.attnum = d.adnum)
102+
LEFT JOIN pg_catalog.pg_collation AS coll ON a.attcollation = coll.oid
103103
LEFT JOIN
104104
pg_catalog.pg_namespace AS collation_namespace
105-
ON collation_namespace.oid = coll.collnamespace
105+
ON coll.collnamespace = collation_namespace.oid
106106
LEFT JOIN
107107
identity_col_seq
108108
ON
109-
identity_col_seq.owner_relid = a.attrelid
110-
AND identity_col_seq.owner_attnum = a.attnum
109+
a.attrelid = identity_col_seq.owner_relid
110+
AND a.attnum = identity_col_seq.owner_attnum
111111
WHERE
112112
a.attrelid = $1
113113
AND a.attnum > 0
@@ -116,7 +116,7 @@ ORDER BY a.attnum;
116116

117117
-- name: GetIndexes :many
118118
SELECT
119-
c.oid AS oid,
119+
c.oid,
120120
c.relname::TEXT AS index_name,
121121
table_c.relname::TEXT AS table_name,
122122
table_namespace.nspname::TEXT AS table_schema_name,
@@ -132,21 +132,25 @@ SELECT
132132
COALESCE(parent_c.relname, '')::TEXT AS parent_index_name,
133133
COALESCE(parent_namespace.nspname, '')::TEXT AS parent_index_schema_name,
134134
(
135-
SELECT ARRAY_AGG(att.attname ORDER BY indkey_ord.ord)
135+
SELECT
136+
ARRAY_AGG(
137+
att.attname
138+
ORDER BY indkey_ord.ord
139+
)
136140
FROM UNNEST(i.indkey) WITH ORDINALITY AS indkey_ord (attnum, ord)
137141
INNER JOIN
138142
pg_catalog.pg_attribute AS att
139-
ON att.attrelid = table_c.oid AND att.attnum = indkey_ord.attnum
143+
ON att.attrelid = table_c.oid AND indkey_ord.attnum = att.attnum
140144
)::TEXT [] AS column_names,
141145
COALESCE(con.conislocal, false) AS constraint_is_local
142146
FROM pg_catalog.pg_class AS c
143-
INNER JOIN pg_catalog.pg_index AS i ON (i.indexrelid = c.oid)
144-
INNER JOIN pg_catalog.pg_class AS table_c ON (table_c.oid = i.indrelid)
147+
INNER JOIN pg_catalog.pg_index AS i ON (c.oid = i.indexrelid)
148+
INNER JOIN pg_catalog.pg_class AS table_c ON (i.indrelid = table_c.oid)
145149
INNER JOIN pg_catalog.pg_namespace AS table_namespace
146150
ON table_c.relnamespace = table_namespace.oid
147151
LEFT JOIN
148152
pg_catalog.pg_constraint AS con
149-
ON (con.conindid = c.oid AND con.contype IN ('p', 'u', null))
153+
ON (c.oid = con.conindid AND con.contype IN ('p', 'u', null))
150154
LEFT JOIN
151155
pg_catalog.pg_inherits AS idx_inherits
152156
ON (c.oid = idx_inherits.inhrelid)
@@ -238,7 +242,7 @@ INNER JOIN
238242
ON pg_proc.pronamespace = proc_namespace.oid
239243
INNER JOIN
240244
pg_catalog.pg_language AS proc_lang
241-
ON proc_lang.oid = pg_proc.prolang
245+
ON pg_proc.prolang = proc_lang.oid
242246
WHERE
243247
proc_namespace.nspname NOT IN ('pg_catalog', 'information_schema')
244248
AND proc_namespace.nspname !~ '^pg_toast'
@@ -358,7 +362,7 @@ SELECT
358362
FROM pg_catalog.pg_namespace AS extension_namespace
359363
INNER JOIN
360364
pg_catalog.pg_extension AS ext
361-
ON ext.extnamespace = extension_namespace.oid
365+
ON extension_namespace.oid = ext.extnamespace
362366
WHERE
363367
extension_namespace.nspname NOT IN ('pg_catalog', 'information_schema')
364368
AND extension_namespace.nspname !~ '^pg_toast'
@@ -370,14 +374,18 @@ SELECT
370374
pg_type.typname::TEXT AS enum_name,
371375
type_namespace.nspname::TEXT AS enum_schema_name,
372376
(
373-
SELECT ARRAY_AGG(pg_enum.enumlabel ORDER BY pg_enum.enumsortorder)
377+
SELECT
378+
ARRAY_AGG(
379+
pg_enum.enumlabel
380+
ORDER BY pg_enum.enumsortorder
381+
)
374382
FROM pg_catalog.pg_enum
375383
WHERE pg_enum.enumtypid = pg_type.oid
376384
)::TEXT [] AS enum_labels
377385
FROM pg_catalog.pg_type AS pg_type
378386
INNER JOIN
379387
pg_catalog.pg_namespace AS type_namespace
380-
ON type_namespace.oid = pg_type.typnamespace
388+
ON pg_type.typnamespace = type_namespace.oid
381389
WHERE
382390
pg_type.typtype = 'e'
383391
AND type_namespace.nspname NOT IN ('pg_catalog', 'information_schema')

internal/queries/queries.sql.go

Lines changed: 74 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)