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

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Eric Brown <eric(dot)brown(at)propel(dot)com>
Cc: Pgsql-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Editor: Syntax highlighting and stored procedures surrounded by '
Date: 2005-01-07 02:48:18
Message-ID: 96446D82-6056-11D9-A399-000A95B03262@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Stafford 2005-01-07 05:45:38 Serial Foreign Key
Previous Message Robert Treat 2005-01-07 01:42:13 Re: disabling OIDs?