#36969 [Bgs]: pg_query_params() fails for integer column with 'INSERT INTO..SELECT DISTINCT'

2007-02-08 Thread alan dot harder at sun dot com
 ID:   36969
 User updated by:  alan dot harder at sun dot com
 Reported By:  alan dot harder at sun dot com
 Status:   Bogus
 Bug Type: PostgreSQL related
 Operating System: Debian
 PHP Version:  5.1.5
 Assigned To:  helly
 New Comment:

for what it's worth, in my setup i only see the problem via PHP.. psql
won't let me "prepare" without a type.  maybe the problem is in the pg8
client library, setting a default type to text if you don't specify.

array(3) { ["client"]=>  string(5) "8.1.4" ["protocol"]=>  int(3)
["server"]=>  string(6) "7.4.13" }

in psql:
testdb=> prepare blah as insert into test select distinct $1;
ERROR:  there is no parameter $1
testdb=> prepare blah(int) as insert into test select distinct $1;
PREPARE

but via PHP,
Warning: pg_query_params() [function.pg-query-params]: Query failed:
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.

adding ::int in the pg_query_params sql does work, as you suggested.


Previous Comments:


[2006-11-11 14:31:52] [EMAIL PROTECTED]

This is not a bug in PHP itself. As you can see below, the same thing
happens using psql (and I'm using PostgreSQL 8.2beta2). Perhaps you
should contact the Postgres guys, or perhaps distinct simply needs you
to be more specific about the type it needs to distinguish against?
$1::int works with distinct, for example.


testdb=# prepare blah as insert into test select distinct $1;
ERROR:  column "i" is of type integer but expression is of type text
HINT:  You will need to rewrite or cast the expression.

testdb=# prepare blah as insert into test select $1; 
PREPARE
testdb=#




[2006-09-26 22:27:47] [EMAIL PROTECTED]

Assigned to the maintainer.

------------

[2006-08-30 18:50:24] alan dot harder at sun dot com

Tested on PHP 5.1.5.. same result.

------------

[2006-04-04 17:00:24] alan dot harder at sun dot com

Description:

parameter given as integer but treated as text with particular sql
syntax.  remove "distinct" from the sql and it works.

Tested with PHP 5.1.2 and PHP 5.1.3-RC2

pg_version output:
array(3) { ["client"]=>  string(5) "8.1.2" ["protocol"]=>  int(3)
["server"]=>  string(6) "7.4.11" }


Reproduce code:
---
First in psql:
create table test (val integer);

Test code:



Expected result:

OK

Actual result:
--
Warning: pg_query_params() [function.pg-query-params]: Query failed:
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression. in
/usr/home/mindless/public_html/pgtest.php on line 5
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.






-- 
Edit this bug report at http://bugs.php.net/?id=36969&edit=1


#36969 [Opn]: pg_query_params() fails for integer column with 'INSERT INTO..SELECT DISTINCT'

2006-08-30 Thread alan dot harder at sun dot com
 ID:   36969
 User updated by:  alan dot harder at sun dot com
 Reported By:  alan dot harder at sun dot com
 Status:   Open
 Bug Type: PostgreSQL related
 Operating System: Debian
-PHP Version:  5.1.3RC2
+PHP Version:  5.1.5
 New Comment:

Tested on PHP 5.1.5.. same result.


Previous Comments:


[2006-04-04 17:00:24] alan dot harder at sun dot com

Description:

parameter given as integer but treated as text with particular sql
syntax.  remove "distinct" from the sql and it works.

Tested with PHP 5.1.2 and PHP 5.1.3-RC2

pg_version output:
array(3) { ["client"]=>  string(5) "8.1.2" ["protocol"]=>  int(3)
["server"]=>  string(6) "7.4.11" }


Reproduce code:
---
First in psql:
create table test (val integer);

Test code:



Expected result:

OK

Actual result:
--
Warning: pg_query_params() [function.pg-query-params]: Query failed:
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression. in
/usr/home/mindless/public_html/pgtest.php on line 5
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.






-- 
Edit this bug report at http://bugs.php.net/?id=36969&edit=1


#36969 [NEW]: pg_query_params fails for integer column with 'insert into..select distinct'

2006-04-04 Thread alan dot harder at sun dot com
From: alan dot harder at sun dot com
Operating system: Debian
PHP version:  5.1.3RC2
PHP Bug Type: PostgreSQL related
Bug description:  pg_query_params fails for integer column with 'insert 
into..select distinct'

Description:

parameter given as integer but treated as text with particular sql syntax.
 remove "distinct" from the sql and it works.

Tested with PHP 5.1.2 and PHP 5.1.3-RC2

pg_version output:
array(3) { ["client"]=>  string(5) "8.1.2" ["protocol"]=>  int(3)
["server"]=>  string(6) "7.4.11" }


Reproduce code:
---
First in psql:
create table test (val integer);

Test code:



Expected result:

OK

Actual result:
--
Warning: pg_query_params() [function.pg-query-params]: Query failed:
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression. in
/usr/home/mindless/public_html/pgtest.php on line 5
ERROR: column "val" is of type integer but expression is of type text
HINT: You will need to rewrite or cast the expression.


-- 
Edit bug report at http://bugs.php.net/?id=36969&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36969&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36969&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36969&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36969&r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=36969&r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=36969&r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=36969&r=needscript
Try newer version:http://bugs.php.net/fix.php?id=36969&r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=36969&r=support
Expected behavior:http://bugs.php.net/fix.php?id=36969&r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=36969&r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=36969&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36969&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36969&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36969&r=dst
IIS Stability:http://bugs.php.net/fix.php?id=36969&r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=36969&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36969&r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=36969&r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=36969&r=mysqlcfg


#32627 [NEW]: realpath fails to return FALSE if last path component does not exist

2005-04-12 Thread alan dot harder at sun dot com
From: alan dot harder at sun dot com
Operating system: FreeBSD 4.11-STABLE
PHP version:  4.3.10
PHP Bug Type: *Directory/Filesystem functions
Bug description:  realpath fails to return FALSE if last path component does 
not exist

Description:

I have found that realpath() returns a path when it should return FALSE if
only the last path component in the given string does not exist.  Tested on
php 4.3.10 and php4-STABLE-200504071438.  Both tests and phpinfo can be
viewed at http://realpath.moshpit.org/


Reproduce code:
---
$x = realpath('/bad/path'); var_dump($x);
$x = realpath('/badpath'); var_dump($x);
$x = realpath('/tmp/badpath'); var_dump($x);

View tests at http://realpath.moshpit.org/


Expected result:

FALSE for all three tests.


Actual result:
--
The first one works (gets FALSE), the other two return the path when they
should return FALSE (assuming /tmp is valid).

-- 
Edit bug report at http://bugs.php.net/?id=32627&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32627&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32627&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32627&r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=32627&r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=32627&r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=32627&r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=32627&r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=32627&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32627&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=32627&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=32627&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=32627&r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=32627&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32627&r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=32627&r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=32627&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32627&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32627&r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=32627&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32627&r=mysqlcfg


#32627 [Csd]: realpath fails to return FALSE if last path component does not exist

2005-04-07 Thread alan dot harder at sun dot com
 ID:   32627
 User updated by:  alan dot harder at sun dot com
 Reported By:  alan dot harder at sun dot com
 Status:   Closed
 Bug Type: Filesystem function related
 Operating System: FreeBSD 4.11-STABLE
 PHP Version:  4.3.10
 New Comment:

thanks for the response.  by "latest" do you mean php5?  as shown in
this bug description I tested with today's stable 4.3.x build in
addition to 4.3.10 where i found the problem.


Previous Comments:


[2005-04-07 21:04:46] [EMAIL PROTECTED]

Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php





[2005-04-07 18:23:45] alan dot harder at sun dot com

Description:

I have found that realpath() returns a path when it should return FALSE
if only the last path component in the given string does not exist. 
Tested on php 4.3.10 and php4-STABLE-200504071438.  Both tests and
phpinfo can be viewed at http://realpath.moshpit.org/


Reproduce code:
---
$x = realpath('/bad/path'); var_dump($x);
$x = realpath('/badpath'); var_dump($x);
$x = realpath('/tmp/badpath'); var_dump($x);

View tests at http://realpath.moshpit.org/


Expected result:

FALSE for all three tests.


Actual result:
--
The first one works (gets FALSE), the other two return the path when
they should return FALSE (assuming /tmp is valid).





-- 
Edit this bug report at http://bugs.php.net/?id=32627&edit=1