On Tue, May 04, 2010 at 04:40:22PM -0700, Josh Berkus wrote:
> Hackers, Driver maintainers,
> 
> The 9.0 "don't rename index cols" behavior has already broken JDBC.  We
> need to get in touch with other driver authors to see if they are
> affected by this, and to let them know that they'll need a new driver
> release for 9.0, if so.

Looks at first glance like it still works for PL/Perl.

I created a table t with single PK text column id, renamed it to
idiotic, and pointed the attached program at it.  Git master
(92b93d85a49eb8d55060aaaa961c0d53e085ed92) is running on port 2225,
and I'm connecting as my shell user.

Here's the SQL I ran before the script.

CREATE table simple(id SERIAL PRIMARY KEY);
ALTER TABLE simple RENAME COLUMN id TO idiotic;
CREATE table complexer(a text, b text, primary key(a,b));
ALTER TABLE complexer RENAME a to alpha, b to bravo;
ALTER TABLE complexer RENAME a to alpha;
ALTER TABLE complexer RENAME b to bravo;

Cheers,
David.
-- 
David Fetter <da...@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fet...@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my @tables = qw(simple complexer);

my $dbh=DBI->connect("dbi:Pg:;port=2225","","")
    or die "Couldn't connect.";

foreach my $table (@tables) {
    my @key_column_names=$dbh->primary_key(undef, "public",$table);
    print "PK column(s): ", join(", ", @key_column_names), ".\n";
    my $sth=$dbh->primary_key_info( undef, "public", $table, {pg_onerow=>2});
    if (defined $sth) {
        my $pk = $sth->fetchall_arrayref()->[0];
        print "Table $pk->[2] has a primary key on these columns:\n";
        for (my $x=0; defined $pk->[3][$x]; $x++) {
            print "Column: $pk->[3][$x]  (data type: $pk->[6][$x])\n";
        }
    }
}
$dbh->disconnect();
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to