Thread: quote style in buffer

quote style in buffer

From
joseph speigle
Date:
hi,

I can't seem to find the comment for an sql file

drop function dups();
-- joe speigle
-- Feb 1 2004
CREATE FUNCTION dups() RETURNS int4
      AS 'SELECT 1 as RESULT' LANGUAGE 'sql';
this always stops after the first line.  I've tried a leading space/tab/single quote/double space and the same after
thehyphens to no avail.   

thanks!!
--
joe speigle

Re: quote style in buffer

From
Michael Glaesemann
Date:
Hi Joseph,

On Feb 1, 2004, at 7:40 PM, joseph speigle wrote:

> hi,
>
> I can't seem to find the comment for an sql file
>
> drop function dups();
> -- joe speigle
> -- Feb 1 2004
> CREATE FUNCTION dups() RETURNS int4
>       AS 'SELECT 1 as RESULT' LANGUAGE 'sql';

it looks like you've got at least one extra pair of single quotes: you
don't need to quote sql.

test=# CREATE OR REPLACE FUNCTION dups() RETURNS int4
test-#       AS 'SELECT 1 as RESULT' LANGUAGE SQL;
CREATE FUNCTION
test=# select * from dups();
  dups
------
     1
(1 row)

Hope that helps.

Michael Glaesemann
grzm myrealbox com


Re: quote style in buffer

From
Tom Lane
Date:
joseph speigle <joe.speigle@jklh.us> writes:
> I can't seem to find the comment for an sql file

> drop function dups();
> -- joe speigle
> -- Feb 1 2004
> CREATE FUNCTION dups() RETURNS int4
>       AS 'SELECT 1 as RESULT' LANGUAGE 'sql';
> this always stops after the first line.

It looks just fine as you've shown it.  Define "stops" --- what did you
do exactly, and what happened exactly?

The only theory that comes to mind right away is that what you think are
newlines are not really, so that the database is seeing the file as one
long line.

            regards, tom lane