Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gqjUO-0002ka-Ej for pgsql-odbc@arkaria.postgresql.org; Mon, 04 Feb 2019 19:01:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gqjUL-0008TF-Io for pgsql-odbc@arkaria.postgresql.org; Mon, 04 Feb 2019 19:01:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gqjUL-0008RU-9k for pgsql-odbc@lists.postgresql.org; Mon, 04 Feb 2019 19:01:01 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gqjUE-0001CH-VD for pgsql-odbc@postgresql.org; Mon, 04 Feb 2019 19:01:00 +0000 Received: by mail-wr1-x431.google.com with SMTP id z18so281006wrh.2 for ; Mon, 04 Feb 2019 11:00:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=nqQPolyoaiZXHDW4f1dXHGoLe/AMnY9TyzXtu+09qjU=; b=s0O59nVIHCv83Uq5XCp3ZJa0REt41m5kim1hgWsDtLrrtk4LVJED39FK09/hbiRdQT bLEeDTWcXX61N8FR7sqLaTjPn9QZfSgof+c9Q7q8lEWP6KAN23mn7CF3gofcd49jm6Td zkSEzpBqLM1rnBCX5f2DYdg/GCMzH8XxE/9BamyXC7fHCQkJbyWyRml+rHp/inyLmjHR SkeuF1IQzl2z7VCFjcrWtwg92XB7FK9PI7Vmc9aK0YpgQGUnUYQ8cYGAgWGFIJ3DqQ40 4Z2bZ8JLYZfFvsFNcYpuc/u4LkVEx/3C13sOxmlM6zla5Rtn1ha5YoHYWqGsc6bKnz2r 24HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=nqQPolyoaiZXHDW4f1dXHGoLe/AMnY9TyzXtu+09qjU=; b=tQKhJ/nkqhxgxhTXNZ0vDfAdHQo1Y3gC+G6uaeG2jUgzpUQ8qwU6qwCGJftLO0yTfc ceXhR5u0vhIGfSa2q5yBiQ3uem2KReOM1XR/sqsfT9FZtWzqijIpdCb398DKSlp8A0rm 5+5vinPJdTLE2oQBDaTHWVYQlqmQjC5svDFiMstvxRSVUneUDjHxHmA/pigYO92MJH79 IK6ssiQNcOCgAU1/se37IsPLQifhvw/yk4MitvVumPap3GjRXTY6XwLKa71d2IThGMqr c8DvTIRIKX3Wthooge14UV3NZFFIRlw4ZmxavaODC5fVQ3F+H0a6q1ErybEZ+o6ue2Dr 2X7Q== X-Gm-Message-State: AHQUAuZefMerF99p7W+ZBZXTtXkd/0lBMDRuWgbo5KQ/3w1anh0OUTJF ZqBvsVngjZEg9QKuoqUsL+z1ymP6 X-Google-Smtp-Source: AHgI3IYHSYkqvN2iI2e0MygM6cCudUm+uNIyzm3MH8o9Fo9vysjWiDYWNkoXIJN3r1xkS7jFb+kGrQ== X-Received: by 2002:adf:9c8a:: with SMTP id d10mr624466wre.244.1549306853395; Mon, 04 Feb 2019 11:00:53 -0800 (PST) Received: from [192.168.0.10] ([95.180.47.253]) by smtp.gmail.com with ESMTPSA id h9sm4281002wrm.49.2019.02.04.11.00.52 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 11:00:52 -0800 (PST) To: pgsql-odbc@postgresql.org From: =?UTF-8?Q?gmail_Vladimir_Kokovi=c4=87?= Subject: PG12 patch Message-ID: <1d7c9847-1e26-f0d9-3492-aed7fa866f46@gmail.com> Date: Mon, 4 Feb 2019 20:00:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F84B4912919C278A121BC2B0" Content-Language: en-GB List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------F84B4912919C278A121BC2B0 Content-Type: multipart/alternative; boundary="------------8ADDC96B5716C6809076F963" --------------8ADDC96B5716C6809076F963 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------8ADDC96B5716C6809076F963 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
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

--------------8ADDC96B5716C6809076F963-- --------------F84B4912919C278A121BC2B0 Content-Type: text/x-patch; name="pg12.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pg12.patch" 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]) --------------F84B4912919C278A121BC2B0--