|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40337 Data inserted by other application NOT ACCESSABLE
Submitted: 2007-02-03 00:27 UTC Modified: 2007-02-05 09:49 UTC
From: R_de__R at hotmail dot com Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: 5.2.0 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2007-02-03 00:27 UTC] R_de__R at hotmail dot com

I created a postgresql user and database and 2 tables and inserted some data into the tables (with psql commandline). Made the postgresql user OWNER of the database with the ability to create more databases but WITHOUT user creation capabilities.
In php I could connect to the database could create more tables and get the data out of the PHP created tables. But access was denied to the tables I created with the psql commandline application!! When I gave the postgresql user, postgresql user CREATION capabilities this went away and I could access all the data .... Pretty WEIRD.

Hope you fix it soon for now I run with overpowered user,

Reproduce code:
$conn = pg_connect("host=localhost port=5432 user=some_user dbname=some_database password=some_pass");

$sql = 'SELECT * from users';
$result = pg_query($conn,$sql);

echo "<table>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
   echo "\t<tr>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
   echo "\t</tr>\n";
echo "</table>\n";

// Free resultset

// Closing connection

Expected result:
Full Access to the data in the database ... Eventhough they were inserted by another aplication !

Actual result:
postgresql user WITHOUT postgresql user creation capabilities CAN'T access data which was inserted by another application. But when the postgresql user CAN make other postgresql users ALL data is accessable (with no changes to php code or database settings...)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-05 09:49 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Data inserted by other users cannot be read by an unprivileged user in Postgres. Nothing to do with PHP in any case.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 24 00:01:31 2024 UTC