Re: How to escape string in Postgres?

hubert depesz lubaczewski <depesz@depesz.com>

From: hubert depesz lubaczewski <depesz@depesz.com>
To: Igor Korot <ikorot01@gmail.com>
Cc: "pgsql-generallists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2026-03-29T11:54:52Z
Lists: pgsql-general
On Sat, Mar 28, 2026 at 11:08:17PM -0700, Igor Korot wrote:
> In MS SQL server one can write a query like so
> SELECT a, b, c FROM [catalog].[schema].[table];
> What do I use in Postgres instead of []?

Generally you put there name of schema and table.

select * from public.zzz;

if your schema/table name would contain "weird" characters, then put the
identifier inside "quotes", like:

select * from "WeirdyNamedSchema"."badly named table";

If that's not what you're after, you have to be more specific.

Best regards,

depesz