pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: lukaseder (@lukaseder) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #538: Why getSchemaName return empty string or exists getBaseSchemaName and getColumnName return getColumnLabel?
Date: Mon, 12 Dec 2022 09:57:27 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
I wonder if this could be implemented relatively easily by now? It was implemented for `PgResultSetMetaData::getTableName`, in case of which a query like this one is issued:
```sql
SELECT
c.oid,
a.attnum,
a.attname,
c.relname,
n.nspname,
a.attnotnull OR (t.typtype = 'd' AND t.typnotnull),
a.attidentity != '' OR pg_catalog.pg_get_expr(d.adbin, d.adrelid) LIKE '%nextval(%'
FROM
pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON
(c.relnamespace = n.oid)
JOIN pg_catalog.pg_attribute a ON
(c.oid = a.attrelid)
JOIN pg_catalog.pg_type t ON
(a.atttypid = t.oid)
LEFT JOIN pg_catalog.pg_attrdef d ON
(d.adrelid = a.attrelid
AND d.adnum = a.attnum)
JOIN (...) vals ON
(c.oid = vals.oid AND a.attnum = vals.attnum)
```
That query produces the schema name (`n.nspname`) and the information is cached. Since users are likely going to call `PgResultSetMetaData::getTableName` as well when they call `PgResultSetMetaData::getSchemaName`, I suspect there wouldn't be any additional overhead?
view thread (31+ 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] issue #538: Why getSchemaName return empty string or exists getBaseSchemaName and getColumnName return getColumnLabel?
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