patch for PGAPI_Columns with Show system tables turned on

patch for PGAPI_Columns with Show system tables turned on

am 18.12.2005 00:42:00 von Ludek Finstrle

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

when I take a look at VB6 and RowCount (again) and I turn Parse
Statement option on there is problem with SQLColAttribute for
select * from pg_class. I found that pg_* is forbidden in PGAPI_Columns
when Show system tables is turned off. I think it's not right behaviour.

I write small patch which changes this behaviour. When is pg_* asked
in PGAPI_Columns directly it doesn't matter if Show system tables is
turned on or off.

Please review and comment

Luf

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="psqlodbc-columns_pg.diff"

diff -c psqlodbc.orig\info.c psqlodbc\info.c
*** psqlodbc.orig\info.c Wed Nov 30 13:44:22 2005
--- psqlodbc\info.c Sun Dec 18 01:37:01 2005
***************
*** 1763,1769 ****
my_strcat1(columns_query, " and a.attname %s '%.*s'", likeeq, szColumnName, cbColumnName);
}

! if (!atoi(ci->show_system_tables))
{
if (conn->schema_support)
strcat(columns_query, " and nspname !~ '^" POSTGRES_SYS_PREFIX "'");
--- 1763,1770 ----
my_strcat1(columns_query, " and a.attname %s '%.*s'", likeeq, szColumnName, cbColumnName);
}

! if ((!atoi(ci->show_system_tables)) &&
! (((cbTableName != SQL_NTS) && (cbTableName < 4)) || (strncmp(szTableName,"pg_",3))))
{
if (conn->schema_support)
strcat(columns_query, " and nspname !~ '^" POSTGRES_SYS_PREFIX "'");

--LZvS9be/3tNcYl/X
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--LZvS9be/3tNcYl/X--

Re: patch for PGAPI_Columns with Show system tables turned on

am 18.12.2005 17:19:38 von Dave Page

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org on behalf of Ludek Finstrle
Sent: Sat 12/17/2005 11:42 PM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] patch for PGAPI_Columns with Show system tables turned on

> when I take a look at VB6 and RowCount (again) and I turn Parse
> Statement option on there is problem with SQLColAttribute for
> select * from pg_class. I found that pg_* is forbidden in PGAPI_Columns
> when Show system tables is turned off. I think it's not right behaviour.

Hmm. I can see arguments for either side, but I think I agree with you - we=
should allow it if the app requests a specific table (or matching wildcard=
).

Regards, Dave.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org