public inbox for [email protected]
help / color / mirror / Atom feedFrom: Wal, Jan Tjalling van der <[email protected]>
To: foxi_yiyi12081003 <[email protected]>
To: [email protected] <[email protected]>
Subject: RE: column_query buffer in PGAPI ColumnPrivileges
Date: Wed, 9 Nov 2022 21:45:16 +0000
Message-ID: <AM0PR01MB563486B9018D8DD263AF1044DD3E9@AM0PR01MB5634.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <MEYP282MB4042E4BBE6781B0DCB3FF260923E9@MEYP282MB4042.AUSP282.PROD.OUTLOOK.COM>
References: <MEYP282MB4042E4BBE6781B0DCB3FF260923E9@MEYP282MB4042.AUSP282.PROD.OUTLOOK.COM>
Dear foxi_yiyi12081003,
I’m not an expert on the inner workings of this specific driver, but in my opinion this is probably correct.
The query that is defined inside appendPQExpBufferStr, asks for data from column table_schema to be returned using a different name: TABLE_SCHEM.
When the results of that query are used further down, the correct name to use them will be that new name.
When the query is run against an running instance of a postgres-database it gives results (over 9000), here limited to just 5.
select '' as TABLE_CAT, table_schema as TABLE_SCHEM,
table_name, column_name, grantor, grantee,
privilege_type as PRIVILEGE, is_grantable from
information_schema.column_privileges where true limit 5;
"table_cat"
"table_schem"
"table_name"
"column_name"
"grantor"
"grantee"
"privilege"
"is_grantable"
"information_schema"
"routines"
"scope_schema"
"xxxxxxxxxxxxx"
"xxxxxxxxxxxxx"
"UPDATE"
"YES"
"information_schema"
"routines"
"dtd_identifier"
"xxxxxxxxxxxxx"
"xxxxxxxxxxxxx"
"INSERT"
"YES"
"pg_catalog"
"pg_stat_progress_vacuum"
"datid"
"xxxxxxxxxxxxx"
"xxxxxxxxxxxxx"
"SELECT"
"YES"
"information_schema"
"role_udt_grants"
"grantor"
"xxxxxxxxxxxxx"
"xxxxxxxxxxxxx"
"SELECT"
"NO"
"pg_catalog"
"pg_namespace"
"nspname"
"xxxxxxxxxxxxx"
"xxxxxxxxxxxxx"
"SELECT"
"YES"
Kind regards JT
From: foxi_yiyi12081003 <[email protected]>
Sent: 09 November 2022 04:18
To: [email protected]
Subject: column_query buffer in PGAPI ColumnPrivileges
Hi,
Is that a bug in psqlodbc-13.02.0000 release version ?
file: info.c : 3734 ?
the SQL Command in the second appendPQExpBuffers
【 and table_schem %s'%s' 】table_schem or table_schema ??
code:
appendPQExpBufferStr(&column_query, "select '' as TABLE_CAT, table_schema as TABLE_SCHEM,"
" table_name, column_name, grantor, grantee,"
" privilege_type as PRIVILEGE, is_grantable from"
" information_schema.column_privileges where true");
op_string = gen_opestr(like_or_eq, conn);
eq_string = gen_opestr(eqop, conn);
if (escSchemaName)
appendPQExpBuffer(&column_query, " and table_schem %s'%s'", eq_string, escSchemaName);
if (escTableName)
appendPQExpBuffer(&column_query, " and table_name %s'%s'", eq_string, escTableName);
if (escColumnName)
appendPQExpBuffer(&column_query, " and column_name %s'%s'", op_string, escColumnName);
if (PQExpBufferDataBroken(column_query))
and I also found the same condition in master branch。
[cid:[email protected]]
Attachments:
[image/png] image001.png (135B, 3-image001.png)
download | view image
view thread (6+ 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: [email protected]
Cc: [email protected], [email protected]
Subject: RE: column_query buffer in PGAPI ColumnPrivileges
In-Reply-To: <AM0PR01MB563486B9018D8DD263AF1044DD3E9@AM0PR01MB5634.eurprd01.prod.exchangelabs.com>
* 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