All Questions
Tagged with php postgresql
25 questions
2
votes
2
answers
2k
views
PosgtreSQL — Is it possible to specify a sequence name in a GENERATED BY DEFAULT AS IDENTITY column?
When using PHP’s lastInsertId() method with PostgreSQL, it’s necessary to know the name of the sequence.
If I defined the column using GENERATED BY DEFAULT AS IDENTITY, I know I can get the sequence ...
5
votes
1
answer
36k
views
SQLSTATE[08006] [7] FATAL: the database system is in recovery mode
I have some problem with PostgreSQL and PostGIS.
I received an error after running the below query with some coordinates on special raster file.
It worked fine until last week.
The query is:
select (...
8
votes
1
answer
1k
views
What does it mean that PostgreSQL "offers" PHP?
On https://www.enterprisedb.com/downloads/postgres-postgresql-downloads :
PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, macOS, Solaris), and Windows. It ...
-1
votes
1
answer
39
views
Multiple JOINs returning only the last referenced table [closed]
I've columns in different tables referenced in a one table, I'm running a query to fetch the fields related to those columns in their respective tables, but the query is returning only the last join (...
0
votes
1
answer
233
views
How do I send an array of strings to PG from PHP without the former becoming confused?
I want to do this, but for more than one string:
SELECT * FROM table WHERE label <> $1
That selects all records from table where the label column is different from a single string. It works.
...
1
vote
1
answer
556
views
How do I get the PostgreSQL query execution time in PHP using the pg_* functions? [closed]
I've spent hours on this page now, looking through everything: https://www.php.net/manual/en/ref.pgsql.php
I can't figure out how to get the "query execution time" from a pg_query (and ...
-1
votes
1
answer
75
views
How to check if a time has been taken by other user?
Let's say I'll add the first user insert into horarios(user, start_time, end_time) values ('7','09:00:00',10:30:00')
With this data on the table the system should only accept for the next value values ...
0
votes
2
answers
1k
views
Parameterized Queries in PostgreSQL using PHP fail to handle null values
I'm using PHP and PostgreSQL on OpenBSD 6.1, with pg_prepare and pg_execute to effect parameterized queries.
$rs = pg_prepare($con, base64_encode($query), $query);
$rs = pg_execute($con, ...
0
votes
1
answer
35
views
Can't see connexion to Postgresql using php
I have created a php form to connect to a remote postgresql database. It seems that I can log in successfully because my message "connexion succeeded" appears.
But I can't see the corresponding line ...
3
votes
2
answers
6k
views
SQL Arrays are returned as strings in PHP
I have a column with type Array, I need to get all the elements in the array, I tried:
SELECT managers_ids::INTEGER[] FROM teams WHERE id = 14
the result is '{8,9,10}'. How can I iterate on the ...
1
vote
1
answer
361
views
Unexpected behavior of the “Money” field in PostgreSQL
I started developing a web sistem using Linux Ubuntu and at some point I had to do the following with the data type "money":
explode(" ", "R$ 3,000.00"); // [0] => "R$" and [1] => "3,000.00"
...
0
votes
1
answer
802
views
postgresql query hangs indefinitely over VPN - new firewall
We have a product where a local linux machine "SCANNER" does some polling on a local network and then stuffs information into a database in our cloud server over an OpenVPN connection, using pg_query (...
1
vote
0
answers
60
views
How can I determine what table a foreign key is used in without a bunch of joins?
I have a few tables as detailed below:
Page:
page_id (PK), createdDateTime
Entry:
page_id (FK), entry_id (PK), order, parent, createdDateTime
Entry_(type)
entry_id (FK, PK), value ((, other columns ...
0
votes
1
answer
12k
views
Combining 2 SELECT queries and printing the results in PostgreSQL
I have 2 queries which I want to use together to produce one output result to the user. The output describes to the user the journey to take to from A to B. I keep getting a syntax error when I try to ...
5
votes
1
answer
15k
views
PostgreSQL UNIQUE constraint error message
On Appendix A: PostgreSQL error codes, it says:
For some types of errors, the server reports the name of a database object (a table, table column, data type, or constraint) associated with the error;...