Re: Creating a function with single quotes

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Creating a function with single quotes
Дата
Msg-id 499D8414.6020002@postnewspapers.com.au
обсуждение исходный текст
Ответ на Creating a function with single quotes  (Shawn Tayler <stayler@washoecounty.us>)
Список pgsql-sql
Shawn Tayler wrote:
> Hello,
> 
> This has me befuddled.  I am trying create a simple experiment, rather
> new to SQL and I am running into an issue with single quotes.  All I can
> find on creating a function states the procedure should be contained
> within single quotes.  My problem comes when I want to use a textual
> representation of an interval.

The documentation for PL/PgSQL goes into quoting in great depth. Read
that if you want to understand. However, the quick and dirty answer is
to use $$ style quoting:

create function csd_interval(integer) returns interval as $$
BEGIN RETURN $1 * interval '1 msec'
END;
$$ LANGUAGE 'plpgsql';

--
Craig Ringer


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Fwd: Re: Creating a function with single quotes
Следующее
От: Jasen Betts
Дата:
Сообщение: Re: Creating a function with single quotes