0

Although there are answers to this on internet but somehow not working for me.

I want to manually change next value for my sequence. In pgAdmin, I can see the sequence Substances_SUBID_seq in the list under Sequences but following query is not working in Query Tool of pgAdmin

select setval('Substances_SUBID_seq', (select max("SUBID") from "Substances"));

The error I get is:

ERROR:  relation "substances_subid_seq" does not exist 
LINE 1: select setval('Substances_SUBID_seq', (select max("SUBID") f...

What am I doing wrong?

0

1 Answer 1

2

If you see it as Substances_SUBID_seq exactly then you should specify the name in double quotes (double quotes inside single quotes)

'"Substances_SUBID_seq"'

That way postgresql does not lowercase it during execution (see the error message).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.