primary key

victor victor at ambra.ro
Mon Dec 22 07:08:27 PST 2003


My system does not find no more the primary key for cust_pkg.
This heapend after I chenged some pachages.
The efect is that freeside is inserting an empty field in pkgnum.
The function primary_key returns nothing.

The function seems to be
sub primary_key {
  my($proto, $dbh, $table) = @_;
  my $sth = $dbh->prepare(<<END) or die $dbh->errstr;
    SELECT a.attname, a.attnum
    FROM pg_class c, pg_attribute a, pg_type t
    WHERE c.relname = '${table}_pkey'
      AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
END
  $sth->execute or die $sth->errstr;
  my $row = $sth->fetchrow_hashref or return '';
  $row->{'attname'};
}
in Pg.pm

They could be many solutions but I wish to make it work as he was designed.
Could be somethig from postgresql?
Thank you




More information about the freeside-users mailing list