Search Postgresql Archives

Re: Re: Please help me to take a look of the erros in my functions. Thanks.

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

 



leaf_yxj <leaf_yxj@xxxxxxx> writes:
> ***********************************************************
> CREATE OR REPLACE FUNCTION truncate_t (IN tablename text)
> RETURNS VOID
> AS
> $$
> BEGIN
> 	EXECUTE 'TRUNCATE TABLE ' || quote_ident(tablename) || 'CASCADE;';

I think you need a space there:

	EXECUTE 'TRUNCATE TABLE ' || quote_ident(tablename) || ' CASCADE;';

> EXCEPTION
> 	WHEN undefined_table THEN
> 		RAISE EXCEPTION 'Table "%" does not exists', tablename;

It's really a pretty bad idea to print your own message instead of using
the system's message.  In this case, you would have figured out the
problem immediately if you'd seen the real error message, which was
presumably bleating about "t1cascade".

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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