Re: how many quotes?

From: Franco Bruno Borghesi <franco(at)akyasociados(dot)com(dot)ar>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how many quotes?
Date: 2003-12-02 17:31:11
Message-ID: 1070386270.6600.2.camel@taz.oficina
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've found the problem, its not about the quotes, it's the way the
assignment is made:
val:=SELECT nextval(\'usuarios_seq\'); <-WRONG
val:=nextval(\'usuarios_seq\'); <-RIGHT

SELECT INTO should work too.

Thanks everyone.

On Tue, 2003-12-02 at 14:12, Richard Huxton wrote:

> On Tuesday 02 December 2003 16:12, Franco Bruno Borghesi wrote:
> > I need a function to fetch the nextval of a sequence (it should do other
> > things, but my problem is the nextval() call), like this:
> >
> > CREATE OR REPLACE FUNCTION test() RETURNS INTEGER AS '
> > DECLARE
> > val INTEGER;
> > BEGIN
> > val:=SELECT nextval(''''''''''usuarios_seq'''''''''');
>
> > I can't figure out how many quotes I should use to call nextval. I've
> > read an article at the techdocs about this, but didn't help me. If
> > anyone knows the *magic* number, please tell me :)
>
> Two, or escape them:
> nextval(''usuarios_seq'')
> or
> nextval(\'usuarios_seq\')

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alex Page 2003-12-02 17:56:45 C Programming with postgres.h - my function crashes the database backend
Previous Message Alex Page 2003-12-02 17:27:59 Re: CREATE TYPE in Postgres 7.3.4