From: Tom Lane <tgl@sss.pgh.pa.us>
To: sud <suds1434@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Question on Table creation
Date: Tue, 20 Feb 2024 16:53:01 -0500
Message-ID: <277379.1708465981@sss.pgh.pa.us> (raw)
In-Reply-To: <CAD=mzVVsTF1VF2UxDehtaTrvgA8tWfaPfGaOmOiGsSQFkEGvxg@mail.gmail.com>
References: <CAD=mzVVsTF1VF2UxDehtaTrvgA8tWfaPfGaOmOiGsSQFkEGvxg@mail.gmail.com>
sud <suds1434@gmail.com> writes:
> We are newly creating tables in postgres 15.4 version and we got the DDL
> auto generated from one of the tools and they look something like below.
> (note- I have modified the exact names to some dummy names.) These are all
> failing because the schema which already exists in the database having name
> 'schema_name' which is all lower case.So then i modified the script to
> remove the double quotes from all the table/column/schema names, as it
> seems postgres makes things case sensitive if they are put in quotes.
> But then encountered the opposite, i.e. some places where it's showing the
> object already created in the database as Upper case or mixed case like
> schema owner which is showing as "*S*chema_*O*wner" as I see in the
> information_schema.schemata data dictionary. And here the scripts failing
> if removing the quotes from the schema owner.
I'd advise reading this section carefully:
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
Notably, the advice to "always quote a particular name or never quote
it" could be a useful rule for you here.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, suds1434@gmail.com
Subject: Re: Question on Table creation
In-Reply-To: <277379.1708465981@sss.pgh.pa.us>
References: <CAD=mzVVsTF1VF2UxDehtaTrvgA8tWfaPfGaOmOiGsSQFkEGvxg@mail.gmail.com> <277379.1708465981@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox