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

Editor: Syntax highlighting and stored procedures surrounded by '

From
Eric Brown
Date:
I use emacs and syntax highlighting is great -- except that because
stored procedures are completely enclosed between two single quotes,
all the coloring is off for that portion. Is there a way to not
surround stored procedures by quotes or does anybody have a solution
that works for them?

Thanks.

Eric Brown
408-571-6341
www.propel.com

Re: Editor: Syntax highlighting and stored procedures surrounded

From
Bruce Momjian
Date:
Eric Brown wrote:
> I use emacs and syntax highlighting is great -- except that because
> stored procedures are completely enclosed between two single quotes,
> all the coloring is off for that portion. Is there a way to not
> surround stored procedures by quotes or does anybody have a solution
> that works for them?

In 8.0 final when released there is special $$ quoting, but not earlier
versions.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

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

From
Eric Brown
Date:
On Jan 6, 2005, at 11:43 AM, Bruce Momjian wrote:
> Eric Brown wrote:
>> I use emacs and syntax highlighting is great -- except that because
>> stored procedures are completely enclosed between two single quotes,
>> all the coloring is off for that portion. Is there a way to not
>> surround stored procedures by quotes or does anybody have a solution
>> that works for them?
>
> In 8.0 final when released there is special $$ quoting, but not earlier
> versions.
>
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?

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

From
John DeSoi
Date:
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