"Stephen Shorrock" <smsh(at)bas(dot)ac(dot)uk> writes:
> createtable := ''CREATE TABLE debugtab(idcol INTEGER PRIMARY KEY DEFAULT NEXTVAL(tmp_seq), value int )'';
> --why can it not find tmp_seq??
You need quotes. For mostly historic reasons, nextval takes a string
argument containing the name of the sequence, which is not what you
wrote here.
You could avoid messing directly with the sequence if you defined the
column as "idcol SERIAL PRIMARY KEY", instead.
regards, tom lane