pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: SophiahHo (@SophiahHo) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3390: Fix PgDatabaseMetaData implementation of catalog as param and return value
Date: Fri, 04 Oct 2024 15:05:56 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Mapping the catalog name to the database name is already canonical in postgres itself, because when I `select pg_get_viewdef('information_schema.schemata', true);`, postgres returns the following view definition:
```sql
SELECT current_database()::information_schema.sql_identifier AS catalog_name,
n.nspname::information_schema.sql_identifier AS schema_name,
u.rolname::information_schema.sql_identifier AS schema_owner,
NULL::name::information_schema.sql_identifier AS default_character_set_catalog,
NULL::name::information_schema.sql_identifier AS default_character_set_schema,
NULL::name::information_schema.sql_identifier AS default_character_set_name,
NULL::character varying::information_schema.character_data AS sql_path
FROM pg_namespace n,
pg_authid u
WHERE n.nspowner = u.oid AND (pg_has_role(n.nspowner, 'USAGE'::text) OR has_schema_privilege(n.oid, 'CREATE, USAGE'::text));
```
An alternative to using `current_database()::information_schema.sql_identifier` for `TABLE_CATALOG` is to select `catalog_name` from the view `information_schema.schemata` to make the driver future-compatible with any design changes in postgres that would allow a postgres connection to access multiple databases. However, as you had alluded, the disadvantage would be the performance hit from the view selecting from `pg_authid`.
view thread (33+ messages) latest in thread
reply
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 using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] PR #3390: Fix PgDatabaseMetaData implementation of catalog as param and return value
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox