Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBI Error when using Postgres 14 on last_insert_id #51

Open
bsi-lz opened this issue Dec 15, 2021 · 7 comments
Open

DBI Error when using Postgres 14 on last_insert_id #51

bsi-lz opened this issue Dec 15, 2021 · 7 comments

Comments

@bsi-lz
Copy link

bsi-lz commented Dec 15, 2021

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
Copy link
Contributor

markov2 commented Dec 15, 2021

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
Copy link
Author

bsi-lz commented Dec 15, 2021

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
Copy link
Author

bsi-lz commented Dec 15, 2021

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

@markov2
Copy link
Contributor

markov2 commented Dec 15, 2021

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

@bsi-lz
Copy link
Author

bsi-lz commented Dec 15, 2021

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
Copy link
Author

bsi-lz commented Dec 15, 2021

Why did i had to reinstall DBD::Pg?

@markov2
Copy link
Contributor

markov2 commented Dec 15, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants