Home > Archive > PostgreSQL Bugs > July 2005 > BUG #1759: domain check constraint ignored in prepared statement









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author BUG #1759: domain check constraint ignored in prepared statement
Boris Sukholitko

2005-07-07, 11:24 am


The following bug has been logged online:

Bug reference: 1759
Logged by: Boris Sukholitko
Email address: bobatonhu@yahoo.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_e
mpty_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@postgresql
.org)

Tom Lane

2005-07-07, 11:24 am

"Boris Sukholitko" <bobatonhu@yahoo.co.uk> writes:
> 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/pgsq...07/msg00006.php

regards, tom lane

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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com