Re: BUG #16252: PL/pgSQL dynamic programming not well suited forworking with different schemas - Mailing list pgsql-bugs

From Pavel Stehule
Subject Re: BUG #16252: PL/pgSQL dynamic programming not well suited forworking with different schemas
Date
Msg-id CAFj8pRDVk3C0aQgVOHQ-L2LDWogt4s3MBW73zjgYBjZfhedp6g@mail.gmail.com
Whole thread Raw
In response to BUG #16252: PL/pgSQL dynamic programming not well suited for working with different schemas  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs


so 8. 2. 2020 v 19:17 odesílatel PG Bug reporting form <noreply@postgresql.org> napsal:
The following bug has been logged on the website:

Bug reference:      16252
Logged by:          Filip Vukovinski
Email address:      filip.vukovinski@net.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


 

pgsql-bugs by date:

Previous
From: Dan Hayes
Date:
Subject: Re: BUG #16245: proj63 from rhel-7 repo depends on sqlite33, but isnot available
Next
From: Jeff Janes
Date:
Subject: Re: BUG #16251: ::text type casting of a constant breaks query performance