Alain Roger wrote: > i would like to know how can i control the returned value from a SQL statement ? > for example, if i do an INSERT INTO... : > 1. how can i know if the INSERT worked ? > i mean i already trapped the unicity violation, but what if > there is another error ? where can i get a complete list of > exceptions ? You can get almost every error message from an INSERT. A few examples: 53100 (DISK FULL), 22004 (NULL VALUE NOT ALLOWED), ... There could be a trigger or a rule involved which could basically do anything in the database... > 2. if the INSERT INTO is successful, how can i know it ? what > is the returned value ? "Returned" sounds like you are referring to a specific API. Which programming language do you use? An INSERT statement is successful iff it does not generate an error message. Of course, this does not necessarily imply that something was inserted - e.g., if there is an INSTEAD DO NOTHING rule on the table. > 3. the same question as point 2 but for all SQL statements > from PostgreSQL. Similar: an statement is successful iff it does not generate an error message. I'd say that's the definition of a successful statement. As to the return value, that depends on the kind of statement: A DELETE (without RETURNING) or CREATE TABLE statement will not return rows, while a SELECT or a DELETE ... RETURNING will. Yours, Laurenz Albe -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general