NCSC-NL / taranis3

Taranis
Other
59 stars 17 forks source link

DBI Error when using Postgres 14 on last_insert_id #51

Open bsi-lz opened 2 years ago

bsi-lz commented 2 years ago

Following error is thrown when using postgres 14 (trying to run collector):
DBD::Pg::db last_insert_id failed: No suitable column found for last_insert_id of table "statistics_collector" at /home/taranis/taranis-3.5.1/perl5/Taranis/Database.pm line 355.
Could this be a problem between DBI and postgres 14?

markov2 commented 2 years ago

Did you run the same version of Taranis on an older version of Postgresql without issues? Did you reinstall DBD::Pg after the upgrade to P14, or do both come natively in your OS?

I haven't tried P14 yet: I am on P12.

bsi-lz commented 2 years ago

Did you run the same version of Taranis on an older version of Postgresql without issues?

  • yes

Did you reinstall DBD::Pg after the upgrade to P14, or do both come natively in your OS?

  • did not reinstall anything - just installed PG14 and stopped PG10, started PG14

I can login etc - currently only "last_inserted_id" seems to be a problem.

bsi-lz commented 2 years ago

Well i will retry with a fresh install (in docker). But that won't happen before next year...

markov2 commented 2 years ago

Okay, so please try "cpan -i DBD::Pg" as well. I cannot find last_insert_id as official P14 change, maybe accidental?

bsi-lz commented 2 years ago

while trying to install DBD::Pg i got an error Pg.h:35:22: error: libpq-fe.h: file not found.
So i had to install postgresql-devel first.
Now DBD::Pg installed and no more error on last_inserted_id occurs.

bsi-lz commented 2 years ago

Why did i had to reinstall DBD::Pg?

markov2 commented 2 years ago

DBD::Pg compiles its own interface to the Postgres client code. When you have DBD::Pg compiled with a different version of the Pg client library, there is a chance that there are discrepancies with the running server. For instance, constants which got a different value. A small chance, but you never know: accidents happen.

Pg.h is part of DBD::Pg. It wants to load "libpq-fe.h", which is part of Postgresql. When you have postgesql-devel installed, it should be there. But you may need to help compilation when the library path is not found.

cd ~/.cpan/build/DBD-Pg*
vi Makefile.PL    # change LIB
perl Makefile.PL
make install