Thread: perform setval() fails?

perform setval() fails?

From
Sebastien FLAESCH
Date:
Hello!

What I am missing here?


test1=> perform setval('mytab1_pkey_seq',5000,false);
ERROR:  syntax error at or near "perform"
LINE 1: perform setval('mytab1_pkey_seq',5000,false);
         ^



test1=> select setval('mytab1_pkey_seq',5000,false);
  setval
--------
    5000
(1 row)



Seb



Re: perform setval() fails?

From
Christophe Pettus
Date:

> On Nov 20, 2020, at 09:00, Sebastien FLAESCH <sf@4js.com> wrote:
> test1=> perform setval('mytab1_pkey_seq',5000,false);
> ERROR:  syntax error at or near "perform"
> LINE 1: perform setval('mytab1_pkey_seq',5000,false);

PERFORM is a PL/pgSQL operation, and can only be used within a PL/pgSQL function.  For a direct call to PostgreSQL,
SELECTis the right operation. 

--
-- Christophe Pettus
   xof@thebuild.com