|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14383 using postgres with DBA causes DBA not to be able to find any keys.
Submitted: 2001-12-07 14:37 UTC Modified: 2003-05-19 18:13 UTC
From: gclarkii at vsservices dot com Assigned: helly (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 4.2.0-dev OS: FreeBSD 4.4-STABLE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
7 + 3 = ?
Subscribe to this entry?

 [2001-12-07 14:37 UTC] gclarkii at vsservices dot com

If I use postgres first within a PHP script then DBA can not find any keys.  

It will return the error:
"Warning: Unable to find DBA identifier 1 in /www/sites/Test/htdocs/dbafuncs.php on line 31"

If I do not use a pg_connect, then it works perfectly.

Here is a short script that triggers it.

$dbh = pg_connect("dbname=helpme user=helpme");
  if (!$dbh) {
    die ("Could not connect to the server");
$dbalocation = "/www/sites/Test/xxadmindb";
echo "$dbalocation<br><br>";
$dbm = dba_open("$dbalocation", "r", "ndbm") || die ("Could not open file");
  if(!$dbm) {
    die ("no handle");
$key = dba_firstkey($dbm);
  if(!$key) {
    echo "<br><br>Error with retreiving Key<br><br>\n";
$info[$key] = dba_fetch($key, $dbm);
  while($key != false) {
    $key = dba_nextkey($dbm);
      if(!$key) { break; }
    $info[$key] = dba_fetch($key, $dbm);


The dba_open works just fine and returns a handle, however anything that needs a key will fail with the above error.

GB Clark


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 03:42 UTC]
Just trying to clarify. 
If you don't use postgresql functions *before* dba functions, your script works as expected?

Could you try it with 4.1.0 to see it helps?


 [2001-12-13 02:33 UTC] gclarkii at vsservices dot com
Yes, if I don't use any postgres commands then the dba stuff works fine.  

 [2001-12-13 02:39 UTC]
Did you try it with 4.1.0? Do you still have the problem?
If you still have problem, could you try snapshot also?

If you still have problem with snapshot, I'll look into what's wrong.
 [2001-12-13 02:51 UTC] gclarkii at vsservices dot com
No, I've not tried it with 4.1.0.

I'm trying to get it or one of the snaps right now and
the servers are slllowwww...:(
Will report back when I get it tested.


 [2001-12-13 03:17 UTC] gclarkii at vsservices dot com
I just tested it with 4.1.0 and I still get the exact same
error,  no change.

I'll try to get a snap if I can and try it.

 [2001-12-13 03:29 UTC] gclarkii at vsservices dot com
Yes the latest snapshop has the same error.
Again, if I comment out the pg_connect call it
works just fine.

 [2001-12-13 04:40 UTC]
Thanks a lot.
I'll take a look at source.  It could be hard to figure out 
what's wrong. Please be patient. 
Since I don't use FreeBSD, I might ask something later.
 [2002-11-06 06:00 UTC]
For me it works, i think.

Could you please try latest cvs version copy new test below to ext/pgsql/tests/30_bug14383.phpt and run the following test script using: 
php run-tests.php ext/pgsql

Bug 14383
$dbh = @pg_connect($conn_str);
if (!$dbh) {
	die ("Could not connect to the server");


database handler: %s
Content String 2
Content 2 replaced
Read during write permitted
Content 2 replaced 2nd time
The 6th value
array(3) {
  ["key number 6"]=>
  string(13) "The 6th value"
  string(27) "Content 2 replaced 2nd time"
  string(23) "The last content string"
===EOF ext/pgsql/tests/30_bug14383.phpt========

 [2003-01-11 11:49 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2003-05-19 18:13 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 17:01:29 2024 UTC