Hello,
I am getting following error while using it with Postgres, when I add any record I am getting
Message: pg_fetch_result(): Argument #1 ($result) must be of type PgSql\Result, bool given
It was working fine few days back but now its showing error, we also have unique id for table as well so not sure what is wrong, we tested but unable to resolve,
I guess there is an issue with the database itself? Maybe you have changed something? The error means that you are getting a Postgres error in the database and hence returning “false”. Maybe there is more info within the error itself? Maybe sending the full error is showing extra information?
From a quick google search it seems that the table is not creating automatically and id for the table. My blind guess would be:
You have changed the database columns and accidentally removed the auto generated column
The auto generated column is working fine but you’ve ended up to have the highest value possible and it can’t generate a new one.
The solutions for the above:
Adding an auto-generated column to a table:
ALTER TABLE your_table_name
ADD COLUMN id SERIAL PRIMARY KEY;
If you suspect that the auto-generated column is not functioning correctly due to reaching the maximum value:
-- Find the maximum value of the id column
SELECT MAX(id) FROM your_table_name;
-- If the maximum value is close to the maximum limit of the data type,
-- you might want to reset the sequence
-- Suppose the sequence name is something like "your_table_name_id_seq"
-- Resetting the sequence would reset the auto-increment counter
-- Replace "your_table_name_id_seq" with the actual sequence name
SELECT setval('your_table_name_id_seq', (SELECT MAX(id) FROM your_table_name) + 1);