Re: Question on Table creation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sud <suds1434(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Question on Table creation
Date: 2024-02-20 21:53:01
Message-ID: 277379.1708465981@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sud <suds1434(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-02-20 23:59:27 Re: Question on Table creation
Previous Message sud 2024-02-20 21:19:20 Question on Table creation