Re: Editor: Syntax highlighting and stored procedures surrounded by '

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Editor: Syntax highlighting and stored procedures surrounded by '
Дата
Msg-id 96446D82-6056-11D9-A399-000A95B03262@pgedit.com
обсуждение исходный текст
Ответ на Re: Editor: Syntax highlighting and stored procedures surrounded by '  (Eric Brown <eric.brown@propel.com>)
Список pgsql-general
Eric,

On Jan 6, 2005, at 2:51 PM, Eric Brown wrote:

> Great! Well, I had to move to 8.0 anyway to get better support for
> passing around composite types. So where is the $$ quoting stuff
> documented? How do I use it?

In the 8.0 beta html documentation you can find at this path
html/sql-syntax.html#SQL-SYNTAX-DOLLAR-QUOTING
(or just look in the index under "dollar quoting")

I thought there was another section some where, but I'm not seeing it
at the moment. Basically, you can replace the function start and end
single quote with $$ and then not worry about doubling or escaping
single quotes in between. For example:

-- trigger to fold all domain names to lowercase, ensure both columns
are not null
create or replace function tg_address_biu() returns trigger as $$
begin
    if new.domain_name is null and new.ip is null then
        raise exception 'Both the domain_name and ip columns cannot be null.';
    end if;
    if new.domain_name is not null then
        new.domain_name = lower(new.domain_name);
    end if;
    return new;
end;
$$ language plpgsql;

The previous quoting method still works, so there is no requirement to
update everything.

If you are using Mac or Windows, pgEdit supports function syntax
coloring with both quoting methods and has support for Emacs key
bindings.


Best,

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


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

Предыдущее
От: Robert Treat
Дата:
Сообщение: Re: disabling OIDs?
Следующее
От: Jonathan Stafford
Дата:
Сообщение: Serial Foreign Key