pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ian Barwick <barwick@gmx.net>
To: dbi-dev@perl.org
To: pgsql-interfaces@postgresql.org
Subject: Patch for DBD::Pg pg_relcheck problem
Date: Mon, 9 Dec 2002 16:31:00 +0100
Message-ID: <200212091631.00125.barwick@gmx.net> (raw)


Attached is a patch against DBD::Pg 1.20 which
fixes the driver-specific function 'table_attributes'
for use with PostgreSQL 7.3 while maintaining
backwards compatibility with older PostgreSQL
versions.

To avoid voodoo with PostgreSQL version numbers
a check is made whether pg_relcheck exists and
the appropriate query (either 7.3 or pre 7.3)
executed. Tested with 7.3 and 7.1.3.

This is hopefully a one off problem requiring this
kind of check. I haven't had a chance to look at
every function in Pg.pm, but it seems this is the
only one "broken" by 7.3.

Comments, corrections etc. welcome!

Ian Barwick
barwick@gmx.net

Attachments:

  [text/x-diff] Pg.patch (781B, ../200212091631.00125.barwick@gmx.net/2-Pg.patch)
  download | inline diff:
619c619,627
<             my ($constraint) = $dbh->selectrow_array("select rcsrc from pg_relcheck where rcname = '${table}_$col_name'");
---
>             # Note: as of PostgreSQL 7.3 pg_relcheck has been replaced
>             # by pg_constraint. To maintain compatibility, check whether
>             # pg_relcheck exists and execute the appropriate query.
> 
>             my ($pre73) = $dbh->selectrow_array("SELECT 1 FROM pg_class WHERE relname='pg_relcheck'") || 0;
>             my $con_query = $pre73 
>              ? "SELECT rcsrc FROM pg_relcheck WHERE rcname = '${table}_$col_name'"
>              : "SELECT consrc FROM pg_catalog.pg_constraint WHERE contype = 'c' AND conname = '${table}_$col_name'";
>             my ($constraint) = $dbh->selectrow_array($con_query);

view thread (22+ messages)  latest in thread

Message-ID: <200212091631.00125.barwick@gmx.net>
Permalink:  ../200212091631.00125.barwick@gmx.net/
Also on:    postgresql.org/message-id/200212091631.00125.barwick@gmx.net

 ·  · 

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: pgsql-hackers@postgresql.org
  Cc: barwick@gmx.net, dbi-dev@perl.org, pgsql-interfaces@postgresql.org
  Subject: Re: Patch for DBD::Pg pg_relcheck problem
  In-Reply-To: <200212091631.00125.barwick@gmx.net>

* 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