Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Andreas 'ads' Scherbaum
On Fri, 06 Mar 2009 10:27:52 -0500 Tom Lane wrote: > Judging from the comments, is_valid (and the internal validity bit) > were a bad design decision that the author later regretted, but felt > he couldn't change for compatibility reasons. I'm not sure why not > ... we make bigger incompatible ch

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Tom Lane
"Andreas 'ads' Scherbaum" writes: > This leads back to my initial question: intended behaviour or just a > bug? And how can one validate an ISBN without raising an error? Judging from the comments, is_valid (and the internal validity bit) were a bad design decision that the author later regretted

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Gregory Stark
Andreas 'ads' Scherbaum writes: > So this function is useless. If the syntax is valid, the check is > already done and is_valid() returns true. If the syntax is invalid, PG > will raise an error even before this function returns. The invalid > marker is not checked at all. This seems pretty cle

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Andreas 'ads' Scherbaum
On Fri, 06 Mar 2009 12:44:31 +0100 Bernd Helmle wrote: > --On Freitag, März 06, 2009 11:32:14 +0100 Andreas 'ads' Scherbaum > wrote: > > I don't see anything that's not already documented. is_valid() checks the > presence of the invalid (!) marker only. It looks like the author never > intend

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Bernd Helmle
--On Freitag, März 06, 2009 11:32:14 +0100 Andreas 'ads' Scherbaum wrote: No. Straight from the source: -- isn_weak(boolean) - Sets the weak input mode. -- This function is intended for testing use only! The validator function should use the weak mode for itself to return 'f' in case of inv

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Andreas 'ads' Scherbaum
On Fri, 06 Mar 2009 10:50:41 + Gregory Stark wrote: > Andreas 'ads' Scherbaum writes: > > > The validator function should use the weak mode for itself to return > > 'f' in case of invalid input. It cannot be the users job to make sure a > > validator function is working as expected. > > Wel

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Gregory Stark
Andreas 'ads' Scherbaum writes: > The validator function should use the weak mode for itself to return > 'f' in case of invalid input. It cannot be the users job to make sure a > validator function is working as expected. Well the input function is being called before the validator function ever

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Andreas 'ads' Scherbaum
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 Director

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Andreas 'ads' Scherbaum
On Fri, 06 Mar 2009 00:32:40 +0100 Bernd Helmle wrote: > --On Freitag, März 06, 2009 02:26:12 +0100 Andreas 'ads' Scherbaum > wrote: > > > 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_

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-06 Thread Bernd Helmle
--On Freitag, März 06, 2009 02:26:12 +0100 Andreas 'ads' Scherbaum wrote: 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); According to the docs, this is int

Re: [HACKERS] Validating problem in the isn contrib module

2009-03-05 Thread A. Kretschmer
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) Gn

[HACKERS] Validating problem in the isn contrib module

2009-03-05 Thread Andreas 'ads' Scherbaum
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 ca