Re: BUG #16252: PL/pgSQL dynamic programming not well suited for working with different schemas

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: filip(dot)vukovinski(at)net(dot)hr, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16252: PL/pgSQL dynamic programming not well suited for working with different schemas
Date: 2020-02-08 18:37:05
Message-ID: CAFj8pRDVk3C0aQgVOHQ-L2LDWogt4s3MBW73zjgYBjZfhedp6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

so 8. 2. 2020 v 19:17 odesílatel PG Bug reporting form <
noreply(at)postgresql(dot)org> napsal:

> The following bug has been logged on the website:
>
> Bug reference: 16252
> Logged by: Filip Vukovinski
> Email address: filip(dot)vukovinski(at)net(dot)hr
> PostgreSQL version: 12.0
> Operating system: Windows 10 18362
> Description:
>
> The %I format specifier for identifiers, does not handle table schema
> prefixes.
>
>
sure. It is expected. Nobody can detect if "." inside name means part of
name or special symbol.

If you want to handle schema, you should to write some

format("SELECT * FROM %I.%I", schema_name, table_name);

For identifier separation, you can use "parse_ident" function

postgres=# SELECT parse_ident('a.b.cax."ass.ss"');
┌──────────────────┐
│ parse_ident │
╞══════════════════╡
│ {a,b,cax,ass.ss} │
└──────────────────┘
(1 row)

Regards

Pavel

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2020-02-08 18:43:36 Re: BUG #16251: ::text type casting of a constant breaks query performance
Previous Message Dan Hayes 2020-02-08 18:25:01 Re: BUG #16245: proj63 from rhel-7 repo depends on sqlite33, but is not available