select nextval(:schema.seqname) is this correct syntax?
I am passing the schema name while executing the script by -v schema=s1
;
getting an error
ERROR: schema ":schema" does not exist
select nextval(:schema.seqname) is this correct syntax?
I am passing the schema name while executing the script by -v schema=s1
;
getting an error
ERROR: schema ":schema" does not exist
Try this:
SELECT NEXTVAL(:'schema'||'.seqname');
This is after a psql line like this:
psql -U user -h host -d dbname -v schema="schemaname"
Bizarre syntax but Craig Ringer's answer to this question led me to the idea: How do you use script variables in psql?