ID: 28089 User updated by: tony at gigaday dot com Reported By: tony at gigaday dot com Status: Open Bug Type: PostgreSQL related Operating System: Gentoo Linux PHP Version: 4.3.4 New Comment:
Sorry, I got the actual and expect results in the wrong boxes in the bug report. :( The incorrect value of -1 is the actual returned value. Previous Comments: ------------------------------------------------------------------------ [2004-04-21 12:17:37] tony at gigaday dot com 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 this bug report at http://bugs.php.net/?id=28089&edit=1