Open nataraj-hates-MS-for-stealing-github opened 1 year ago
Your report is unclear. Could you specify the steps to reproduce and provide a short Perl program which shows the problem? Thank you!
Hm... Tried to write step by step guide how to reproduce it, and found out that I can not reproduce this from scratch on clean environment... Will need more time to revert my dev server and project I am working on to original configuration, where I met this issue, and then will try to reproduce it there, finding the key point... This might take some time
Understood. Thank you for your efforts. In the meantime perhaps someone else will have some insight into the issue.
I found the cause...
If you set use warnings FATAL => 'all';
in your program, and try to run query that fails, on DB with non-latin utf8 locale for error messages, you will get Wide character in subroutine entry
warning, and thus program will be terminated before real error message will be printed.
Quite a good way to shoot own leg...
But I guess this Wide character in subroutine entry
warning should be fixed anyway, if it is possible, I guess...
Do you need more detailed instructions for bug reproduction?
Do you need more detailed instructions for bug reproduction?
Well, it wouldn't hurt....
On clean Debian (or Debian based) installation do:
sudo dpkg-reconfigure locales
add ru_RU.UTF-8
and choose it as default locale.
Exit shell and login again.
sudo apt-get install postgresql libdbd-pg-perl
sudo su postgres
createuser -P test-user #set password 123
createdb -O test-user test-db
echo "create table test(i integer not null)" | psql -U test-user -h 127.0.0.1 test-db
Run following script:
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use DBD::Pg;
my $dbh = DBI->connect("dbi:Pg:dbname=test-db;host=127.0.0.1", "test-user", "123", {
PrintError => 0,
RaiseError => 1,
AutoCommit => 1,
FetchHashKeyName => 'NAME_lc',
}) or die("Can't access the database");
my $sth = $dbh->prepare( "INSERT INTO test (i) values (?)");
$sth->bind_param(1, undef);
$sth->execute();
It will give you
Wide character in subroutine entry at ./test3.pl line 17.
This a real problem, you will have hard time finding the real cause of why program fails.
Now comment out use warnings FATAL => 'all';
and run script again. It will give you
Wide character in subroutine entry at ./test3.pl line 17.
DBD::Pg::st execute failed: ОШИБКА: значение NULL в столбце "i" отношения "test" нарушает ограничение NOT NULL
DETAIL: Ошибочная строка содержит (null). at ./test3.pl line 17.
Two last lines is expected error message in Russian, and first line should not be there from my point of view.
Update: see https://github.com/bucardo/dbdpg/issues/108#issuecomment-1356863860 below, to get up to date bug description.
I've stabled a problem: I have DB initialized with non-English (and not Latin) utf8 locale. (It is Russian, but this is not really importaint)
I am connecting to the DB via network (this one is important, peer connection works well)
I am running a query that fails with an error.
Program dies, (as I have
RaiseError => 1
) but does not print any error text, it is only printsWide character in print
error message.When I reinitialized DB cluster running it with en_US.UTF8 locale, this problem have gone. I got proper error message.
Main question: is this problem known? If it is not, or known but did not fixed yet, I will explore it more, and provide more detailed but report.