Skip to content

Commit 36583af

Browse files
fix: remove pg_catalog prefix from timestamp and time types
- Add handlers for 'timestamp' and 'time' types in TypeName function - Follow existing pattern used for timestamptz and timetz - Fixes issue where timestamp(2) was showing as pg_catalog.timestamp(2) - Fixes issue where time and time(3) were showing pg_catalog prefix Fixes #204 Co-Authored-By: Dan Lynch <[email protected]>
1 parent c37f204 commit 36583af

File tree

2 files changed

+2984
-2969
lines changed

2 files changed

+2984
-2969
lines changed

packages/deparser/__tests__/pretty/__snapshots__/pg-catalog.test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ exports[`non-pretty: misc/pg_catalog-17.sql 1`] = `"SELECT json_agg(name) FROM (
3636

3737
exports[`non-pretty: misc/pg_catalog-timestamp-etc-1.sql 1`] = `"CREATE TABLE public."ACTIVITY" ("ACTIVITY_ID" bigint NOT NULL, "PUBLISHED" timestamp(2) with time zone)"`;
3838

39-
exports[`non-pretty: misc/pg_catalog-timestamp-etc-2.sql 1`] = `"CREATE TABLE public."ACTIVITY" ("ACTIVITY_ID" bigint NOT NULL, "PUBLISHED" pg_catalog.timestamp(2))"`;
39+
exports[`non-pretty: misc/pg_catalog-timestamp-etc-2.sql 1`] = `"CREATE TABLE public."ACTIVITY" ("ACTIVITY_ID" bigint NOT NULL, "PUBLISHED" timestamp(2))"`;
4040

4141
exports[`non-pretty: misc/pg_catalog-timestamp-etc-3.sql 1`] = `"CREATE TABLE public."EXAMPLE" ("MESSAGE" text)"`;
4242

43-
exports[`non-pretty: misc/pg_catalog-timestamp-etc-4.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIME" ("START_TIME" pg_catalog.time)"`;
43+
exports[`non-pretty: misc/pg_catalog-timestamp-etc-4.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIME" ("START_TIME" time)"`;
4444

4545
exports[`non-pretty: misc/pg_catalog-timestamp-etc-5.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIMETZ" ("START_TIME" time with time zone)"`;
4646

47-
exports[`non-pretty: misc/pg_catalog-timestamp-etc-6.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIME_PRECISION" ("START_TIME" pg_catalog.time(3))"`;
47+
exports[`non-pretty: misc/pg_catalog-timestamp-etc-6.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIME_PRECISION" ("START_TIME" time(3))"`;
4848

4949
exports[`non-pretty: misc/pg_catalog-timestamp-etc-7.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIMETZ_PRECISION" ("START_TIME" time(3) with time zone)"`;
5050

51-
exports[`non-pretty: misc/pg_catalog-timestamp-etc-8.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIMESTAMP" ("CREATED_AT" pg_catalog.timestamp)"`;
51+
exports[`non-pretty: misc/pg_catalog-timestamp-etc-8.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIMESTAMP" ("CREATED_AT" timestamp)"`;
5252

5353
exports[`non-pretty: misc/pg_catalog-timestamp-etc-9.sql 1`] = `"CREATE TABLE public."EXAMPLE_TIMESTAMPTZ" ("CREATED_AT" timestamp with time zone)"`;
5454

@@ -129,7 +129,7 @@ exports[`pretty: misc/pg_catalog-timestamp-etc-1.sql 1`] = `
129129
exports[`pretty: misc/pg_catalog-timestamp-etc-2.sql 1`] = `
130130
"CREATE TABLE public."ACTIVITY" (
131131
"ACTIVITY_ID" bigint NOT NULL,
132-
"PUBLISHED" pg_catalog.timestamp(2)
132+
"PUBLISHED" timestamp(2)
133133
)"
134134
`;
135135

@@ -141,7 +141,7 @@ exports[`pretty: misc/pg_catalog-timestamp-etc-3.sql 1`] = `
141141

142142
exports[`pretty: misc/pg_catalog-timestamp-etc-4.sql 1`] = `
143143
"CREATE TABLE public."EXAMPLE_TIME" (
144-
"START_TIME" pg_catalog.time
144+
"START_TIME" time
145145
)"
146146
`;
147147

@@ -153,7 +153,7 @@ exports[`pretty: misc/pg_catalog-timestamp-etc-5.sql 1`] = `
153153

154154
exports[`pretty: misc/pg_catalog-timestamp-etc-6.sql 1`] = `
155155
"CREATE TABLE public."EXAMPLE_TIME_PRECISION" (
156-
"START_TIME" pg_catalog.time(3)
156+
"START_TIME" time(3)
157157
)"
158158
`;
159159

@@ -165,7 +165,7 @@ exports[`pretty: misc/pg_catalog-timestamp-etc-7.sql 1`] = `
165165

166166
exports[`pretty: misc/pg_catalog-timestamp-etc-8.sql 1`] = `
167167
"CREATE TABLE public."EXAMPLE_TIMESTAMP" (
168-
"CREATED_AT" pg_catalog.timestamp
168+
"CREATED_AT" timestamp
169169
)"
170170
`;
171171

0 commit comments

Comments
 (0)