Validating problem in the isn contrib module
Hello all,
i'm playing around with the isn contrib module and ran into an
annoying problem. The module defines an is_valid() function which
obviously is intended to check the validity of an ISBN number. Makes
sense to have such a function because if the user mistyped the number
the application can raise an error.
Now it seems that instead of the application PostgreSQL is raising the
error:
test=# select is_valid('978-3-937514-69-7'::isbn13);
is_valid
----------
t
(1 row)
test=# select is_valid('978-3-937514-69-6'::isbn13);
ERROR: invalid check digit for ISBN number: "978-3-937514-69-6",
should be 7 ROW 1: select is_valid('978-3-937514-69-6'::isbn13);
^
The first ISBN is valid and the validator function returns 't', that's
fine. The second ISBN is invalid, i mistyped one number. The expected
output is 'f', PG is not supposed to raise an error and break my entire
transaction.
Is this just a bug or is this intended behaviour. And if it's not a
bug, how can i validate an ISBN number in my application - without
raising an error?
Thank you & kind regards
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
In response to Andreas 'ads' Scherbaum :
Hello all,
test=# select is_valid('978-3-937514-69-7'::isbn13);
is_valid
----------
t
(1 row)
Nice advertisement for your book...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
On Fri, 6 Mar 2009 07:14:20 +0100 A. Kretschmer wrote:
Nice advertisement for your book...
Actually the example is copy&paste from the .tex file ;-)
Bye
--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors