perform setval() fails?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

perform setval() fails?

Sebastien FLAESCH
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


Reply | Threaded
Open this post in threaded view
|

Re: perform setval() fails?

Christophe Pettus-2


> On Nov 20, 2020, at 09:00, Sebastien FLAESCH <[hidden email]> 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, SELECT is the right operation.

--
-- Christophe Pettus
   [hidden email]