1--TEST-- 2Bug #37100 (data is returned truncated with BINARY CURSOR) (9.0+) 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php 7include("inc/skipif.inc"); 8skip_bytea_not_hex(); 9?> 10--FILE-- 11<?php 12 13include 'inc/config.inc'; 14$table_name = 'table_bug37100_9'; 15 16$db = pg_connect($conn_str); 17 18pg_query($db, "CREATE TABLE {$table_name} (binfield byteA) ;"); 19pg_query($db, "INSERT INTO {$table_name} VALUES (decode('0103AA000812','hex'))"); 20 21 22$data = pg_query($db, "SELECT binfield FROM {$table_name}"); 23$res = pg_fetch_result($data, null, 0); 24var_dump($res); 25var_dump(bin2hex(pg_unescape_bytea($res))); 26 27$sql = "BEGIN; DECLARE mycursor BINARY CURSOR FOR SELECT binfield FROM {$table_name}; FETCH ALL IN mycursor;"; 28 29$data = pg_query($db, $sql); 30$res = pg_fetch_result($data, null, 0); 31 32var_dump(strlen($res)); 33var_dump(bin2hex($res)); 34 35pg_close($db); 36 37$db = pg_connect($conn_str); 38pg_close($db); 39 40 41?> 42--CLEAN-- 43<?php 44require_once('inc/config.inc'); 45$table_name = 'table_bug37100_9'; 46 47$db = pg_connect($conn_str); 48pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); 49?> 50--EXPECT-- 51string(14) "\x0103aa000812" 52string(12) "0103aa000812" 53int(6) 54string(12) "0103aa000812" 55