#22918 [NEW]: postgres get default sql is missing 1 and.
| From: | alan at akbkhome dot com | Date: | Thu, 27 Mar 2003 05:28:06 +0000 |
| Subject: | #22918 [NEW]: postgres get default sql is missing 1 and. | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-14654@lists.php.net to get a copy of this message | ||
From: alan at akbkhome dot com
Operating system: all
PHP version: 4.3.2RC1
PHP Bug Type: PEAR related
Bug description: postgres get default sql is missing 1 and.
Ok, - the patch below is probably buggered up.. - but
the principle is that you need to add AND f.attnum = a.adnum to the end
of the get default value query otherwise any rows with defaults will get
the same value as the first one.
Index: DB/pgsql.php
===================================================================
RCS file: /repository/pear/DB/DB/pgsql.php,v
retrieving revision 1.17
diff -u -r1.17 pgsql.php
--- DB/pgsql.php 14 Feb 2003 11:02:00 -0000 1.17
+++ DB/pgsql.php 27 Mar 2003 05:24:39 -0000
@@ -606,7 +606,7 @@
FROM pg_attribute f, pg_class tab,
pg_type typ, pg_attrdef a
WHERE tab.relname = typ.typname AND
typ.typrelid = f.attrelid
AND f.attrelid = a.adrelid AND
f.attname = '$field_name'
- AND tab.relname = '$table_name'");
+ AND tab.relname = '$table_name' AND
f.attnum = a.adnum");
$row = @pg_fetch_row($result, 0);
$num = str_replace('\'', '', $row[0]);
--
Edit bug report at http://bugs.php.net/?id=22918&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22918&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22918&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22918&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22918&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22918&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22918&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22918&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22918&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22918&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22918&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22918&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22918&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22918&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22918&r=gnused