dbTalk Databases Forums  

[BUGS] BUG #1759: domain check constraint ignored in prepared statement

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1759: domain check constraint ignored in prepared statement in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Boris Sukholitko
 
Posts: n/a

Default [BUGS] BUG #1759: domain check constraint ignored in prepared statement - 07-07-2005 , 10:02 AM







The following bug has been logged online:

Bug reference: 1759
Logged by: Boris Sukholitko
Email address: bobatonhu (AT) yahoo (DOT) co.uk
PostgreSQL version: 7.4.8
Operating system: Linux
Description: domain check constraint ignored in prepared statement
Details:

Hi,

It seems that the domain check constraint does not trigger
an error when using prepared statement in perl's DBD::Pg 1.42.

It seemed to work in earlier versions of DBD::Pg module.

The following code snippet manifests the problem:
#!/usr/bin/perl -w
use strict;
use DBI;
use DBD::Pg;

my $dbh = DBI->connect("dbi:Pg:dbname=testdb");
$dbh->do(<<ENDS);
create domain display_text_d text
constraint display_text_d_non_empty_chk check (VALUE ~
'[a-zA-z0-9]');
create table domain_test (d display_text_d not null);
ENDS

my $s = $dbh->prepare("insert into domain_test (d) values (?)");

# This execute will succeed leaving invalid value
# in the database
$s->execute(' ');

# This statement fails due to the check constraint
# as expected
$dbh->do("insert into domain_test (d) values (?)", undef, ' ');

Thanks,
Boris.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1759: domain check constraint ignored in prepared statement - 07-07-2005 , 10:17 AM






"Boris Sukholitko" <bobatonhu (AT) yahoo (DOT) co.uk> writes:
Quote:
It seems that the domain check constraint does not trigger
an error when using prepared statement in perl's DBD::Pg 1.42.
I think this is the same issue discussed in this thread:
http://archives.postgresql.org/pgsql...7/msg00006.php

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.