Nette\Database\Table\Selection::insert() to PostgreSQL table with PK without sequence
Notice: This thread is very old.
- carlos
- Member | 4
Hi,
I have a problem with inserting to table with primary key without sequence. Nette (PDO) not throw exception, bud in SQL log is
2017-01-25 01:39:24 GMT ERROR: lastval is not yet defined in this session
2017-01-25 01:39:24 GMT STATEMENT: SELECT LASTVAL()
PostgreSQL 9.6.1, PHP 5.6, Nette 2.4
on every INSERT called query like this
-- primary key basket_id, product_id
INSERT INTO "basket_product" ("basket_id", "product_id", "quantity")
VALUES (132, 17489, 1);
SELECT LASTVAL();
but LASTAVAL() can be called only after update sequence
Its bug or bad using?
I tried fix it
instead of
to block call lastInsettId().
Thanks