From: tony at gigaday dot com Operating system: Gentoo Linux PHP version: 4.3.4 PHP Bug Type: PostgreSQL related Bug description: pg_field_size always returns -1 instead of actual field size
Description: ------------ I am unable to get pg_field_size to return the correct storage size of a field; I have pg_field_num and pg_field_type working but not pg_field_size. Reproduce code: --------------- <?php // get fields sizes for currency file $dbconn_str = "host=localhost port=5432 dbname=pacs user=YYY password=XXXX"; if ( $dbconn = pg_connect($dbconn_str) ) { if ( !$db_status = pg_connection_status($dbconn) ) { $res = pg_query($dbconn, "select * from ccy limit 1"); $ccy_code_fnr = pg_field_num($res, "ccy_code"); $ccy_code_type = pg_field_type($res, $ccy_code_fnr); $ccy_code_size = pg_field_size($res, $ccy_code_fnr); echo "res:", $res, " code:", $ccy_code_fnr, " type:", $ccy_code_type, " size:", $ccy_code_size; ?> Expected result: ---------------- res:Resource id #3 code:0 type:bpchar size:-1 Actual result: -------------- res:Resource id #3 code:0 type:bpchar size:6 since psql gives:- pacs=# \d ccy Table "public.ccy" Column | Type | Modifiers ---------------+---------------+----------- ccy_code | character(6) | not null ccy_desc | character(20) | ccy_curr_rate | numeric(12,4) | ccy_std_rate | numeric(12,4) | ccy_alt_rate | numeric(12,4) | Indexes: ccy_pkey primary key btree (ccy_code) pacs=# -- Edit bug report at http://bugs.php.net/?id=28089&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28089&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28089&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28089&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28089&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28089&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28089&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28089&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28089&r=support Expected behavior: http://bugs.php.net/fix.php?id=28089&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28089&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28089&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28089&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28089&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28089&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28089&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28089&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28089&r=float