Closed SystemDataModel closed 6 months ago
The comparison should be case insensitive, as connector names are case insensitive as well (see SessionFactory). The canonical name is "postgresql".
Another improvement
In Postgres, the name of the sequence is autogenerated and is always tablename_columnname_seq.
So, the code below generates an exception: session << "SELECT currval('id_seq')", into(id), now;
Everything works for me with the following fixes: else if (session.connector() == "postgresql") { session << "SELECT lastval()", into(id), now; }
Sincerely yours
Describe the bug I use Poco ActiveRecord with PostgreSQL 16.
I use ActiveRecord::lastInsertID(Poco::Data::Session& session) where Data::Session is a PostgreSQL Session.
In Data::Session, session.connector() returns "postgresql"
This method is used in ActiveRecord::lastInsertID and test with "if (session.connector() == "PostgreSQL")". This condition is not satisfied.
To Reproduce
m_pSession = Poco::SharedPtr(new Session(PostgreSQL::Connector::KEY, dbConnString));
Context::Ptr pContext = new Context(*m_pSession);
Use this context with ActiveRecord
Expected behavior
Change test "if (session.connector() == "PostgreSQL")" by "if (session.connector() == "postgresql")" in ActiveRecord::lastInsertID
Logs No Logs
Screenshots No screenshots
Please add relevant environment information:
Additional context I use Postgres tables with INHERITANCE relationship between tables. I use "bigserial" id as primary key in tables