Thread: Raise Exception

Raise Exception

From
"Mario Reis"
Date:
  Dear Sir,

 I' ve recently join to PostGreSql community. I'm testing it on a local
network and I'm very found of it .
However there are a few things that I'd like to understand better.

 As far as i realise, every time the Server validates a wrong value for an
input it Raises an Exception with the check failure for each input "for each
record"
 For example, for each invalid foreing key, it automaticly raises an
exception.If you
have a large file 20fields to validate before insert the validates each on
at a time and
raises an exception for each falure.
 As far as i understand it should join all  the validities from each field
record and latter
 display/notify, all them at once, joinning all the errors after an insert
or update instruction
 for each record of course.
 This way it w'll save time and resouces communications special in a large
network with a large
 number of users.

 Sorry if i got it wrong. I also appologise if this isn't the right place to
put this question but
i don't know where else puting it.

 I hope you w'll understand what i mean. Sorry for my poor english.

 Thanks any way

 Mário


Re: Raise Exception

From
Alvaro Herrera
Date:
On Mon, Apr 04, 2005 at 09:24:17AM -0000, Mario Reis wrote:

[Cc: to pgsql-hackers dropped]

>  As far as i realise, every time the Server validates a wrong value
>  for an input it Raises an Exception with the check failure for each
>  input "for each record"
>  For example, for each invalid foreing key, it automaticly raises an
>  exception.If you have a large file 20fields to validate before insert
>  the validates each on at a time and raises an exception for each
>  falure.

Actually this depends on the client side.  The server sends one error
message to the client, the first time an error is found.  If the client
continues sending data, eventually another error will be found and
another error message will be sent.  It is up to the client to either
stop sending data as soon as an error is found, or to collect all errors
and report later.

If you want to load large amounts of data in a table and have rejected
data end up in a separate file, you can do so using the "pgloader"
project from http://pgfoundry.org.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre)