pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: gmail Vladimir Koković <vladimir.kokovic@gmail.com>
To: pgsql-odbc@postgresql.org
Subject: PG12 patch
Date: Mon, 4 Feb 2019 20:00:51 +0100
Message-ID: <1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com> (raw)

Hello, I use the PostgreSQL-devel server with which the psqlodbc-git 
version does not work because the field 'relhasoids' was dropped in 
PG12. After applying the patch that I send you, my huge c++ ODBC 
application now works again with PostgreSQL-devel server. Vladimir 
Koković DP senior(69), Belgrade, Serbia

Attachments:

pg12.patch (text/x-patch, 2.8K) download diff --git a/configure.ac b/configure.ac index 12f3844..bff7f5a 100644 --- a/configure.ac +++ b/configure.ac @@ -152,7 +152,7 @@ if test "$with_libpq" != yes; then if test -d "$with_libpq"; then - PATH="$PATH:$with_libpq/bin" + PATH="$with_libpq/bin:$PATH" CPPFLAGS="$CPPFLAGS -I$with_libpq/include -I$with_libpq/include/postgresql/internal" LDFLAGS="$LDFLAGS -L$with_libpq/lib" else diff --git a/info.c b/info.c index 052f0ae..451b1d4 100644 --- a/info.c +++ b/info.c @@ -2341,9 +2341,11 @@ "t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull, " "c.relhasrules, c.relkind, c.oid, pg_get_expr(d.adbin, d.adrelid), " "case t.typtype when 'd' then t.typbasetype else 0 end, t.typtypmod, " - "c.relhasoids, %s, c.relhassubclass " + "%s, %s, c.relhassubclass " "from (((pg_catalog.pg_class c " - "inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace", PG_VERSION_GE(conn, 10.0) ? "attidentity" : "''"); + "inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace", + PG_VERSION_GE(conn, 12.0) ? "0" : "c.relhasoids", + PG_VERSION_GE(conn, 10.0) ? "attidentity" : "''"); if (search_by_ids) appendPQExpBuffer(&columns_query, " and c.oid = %u", reloid); else @@ -2857,7 +2859,11 @@ /* * Create the query to find out if this is a view or not... */ - appendPQExpBufferStr(&columns_query, "select c.relhasrules, c.relkind, c.relhasoids"); + appendPQExpBufferStr(&columns_query, "select c.relhasrules, c.relkind"); + if (PG_VERSION_LT(conn, 12.0)) + appendPQExpBufferStr(&columns_query, ", c.relhasoids"); + else + appendPQExpBufferStr(&columns_query, ", 0 as relhasoids"); appendPQExpBufferStr(&columns_query, " from pg_catalog.pg_namespace u," " pg_catalog.pg_class c where " "u.oid = c.relnamespace"); @@ -3246,7 +3252,7 @@ initPQExpBuffer(&index_query); printfPQExpBuffer(&index_query, "select c.relname, i.indkey, i.indisunique" ", i.indisclustered, a.amname, c.relhasrules, n.nspname" - ", c.oid, d.relhasoids, %s" + ", c.oid, %s, %s" " from pg_catalog.pg_index i, pg_catalog.pg_class c," " pg_catalog.pg_class d, pg_catalog.pg_am a," " pg_catalog.pg_namespace n" @@ -3256,6 +3262,7 @@ " and d.oid = i.indrelid" " and i.indexrelid = c.oid" " and c.relam = a.oid order by" + , PG_VERSION_LT(conn, 12.0) ? "d.relhasoids" : "0" , PG_VERSION_GE(conn, 8.3) ? "i.indoption" : "0" , eq_string, escTableName, eq_string, escSchemaName); appendPQExpBufferStr(&index_query, " i.indisprimary desc,"); diff --git a/parse.c b/parse.c index e7cb847..0ff76bc 100644 --- a/parse.c +++ b/parse.c @@ -474,6 +474,8 @@ TABLE_INFO *ti; MYLOG(0, "Entering\n"); + if (PG_VERSION_GE(conn, 12.0)) + return FALSE; if (0 != SC_checked_hasoids(stmt)) return TRUE; if (!stmt->ti || !stmt->ti[0])

Message-ID: <1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com>
Permalink:  ../1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com/
Also on:    postgresql.org/message-id/1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com

 ·  · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: vladimir.kokovic@gmail.com
  Subject: Re: PG12 patch
  In-Reply-To: <1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com>
  References: <1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox