Search Postgresql Archives

error handling codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PostGresQL 8 beta1.
PGAdmin III beta 1.21

Is there a way to see what error code or error message occured when an error
happens?
I am trying to perform exception handling and a create view that included
another view that did not exist occured in a plpgsql function.
I finally figured out that the error was Undefined_table, though that is
obviously not implicit.
The error I received was "relation "bob2" does not exist" There were no
error numbers or other indications that led me to the correct error code in
Appendix A of the documentation.
I could not find in the documentation if there is any functionality
available to the exception, such as exception.number, exception.message
etc.. Does duch a thing exist?

As an example here is the code I am testing. The view name was false on
purpose in this test so I could figure out how to handle it when I really
get a view that is wrong.

Thanks
Sim

create or replace function testexcept() returns void as
$$
begin
begin
create view dummy as
 select * from dummy2;
exception
 when UNDEFINED_TABLE then
  raise notice 'its an undefined table';
 when others then
  raise notice 'it is not an undefined table';
end;
return;
end;
$$ language 'plpgsql'



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux