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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re: Please help me to take a look of the erros in my functions. Thanks.
Дата
Msg-id 6254.1333463643@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Please help me to take a look of the erros in my functions. Thanks.  (leaf_yxj <leaf_yxj@163.com>)
Ответы Re: Please help me to take a look of the erros in my functions. Thanks.  (leaf_yxj <leaf_yxj@163.com>)
Re: Re: Please help me to take a look of the erros in my functions. Thanks.  (Bartosz Dmytrak <bdmytrak@gmail.com>)
Список pgsql-general
leaf_yxj <leaf_yxj@163.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: leaf_yxj
Дата:
Сообщение: Re: Please help me to take a look of the erros in my functions. Thanks.
Следующее
От: leaf_yxj
Дата:
Сообщение: Re: Please help me to take a look of the erros in my functions. Thanks.