Skip to content

pg_catalog.timestamp(0) instead of timestamp(0) #204

@murashki

Description

@murashki

Hello team!

I can’t get a clean output from desparse. Please take a look at these two code snippets. One of them produces timestamp(2) with time zone. Perfect! The other gives pg_catalog.timestamp(2), and that’s depressing. I’d like the second case to output either timestamp(2) with time zone or just timestamp(2), but not what it does now.

import { parse, deparse } from 'pgsql-parser'; // 17.7.8

const parsed = await parse(`
  CREATE TABLE public."ACTIVITY" (
    "ACTIVITY_ID" bigint NOT NULL,
    "PUBLISHED" timestamp(2) with time zone
  )
`);

const desparsed = await deparse(parsed);

console.log(desparsed);
// CREATE TABLE public."ACTIVITY" ("ACTIVITY_ID" bigint NOT NULL, "PUBLISHED" timestamp(2) with time zone)
import { parse, deparse } from 'pgsql-parser'; // 17.7.8

const parsed = await parse(`
  CREATE TABLE public."ACTIVITY" (
    "ACTIVITY_ID" bigint NOT NULL,
    "PUBLISHED" timestamp(2)
  )
`);

const desparsed = await deparse(parsed);

console.log(desparsed);
// CREATE TABLE public."ACTIVITY" ("ACTIVITY_ID" bigint NOT NULL, "PUBLISHED" pg_catalog.timestamp(2))

Can’t figure out why the code is written this way. And where are timestamp and time?

PLAYGROUND

The same goes for the pg_catalog.text :-(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions