I am trying to use the PostgreSQL currval function to return the last inserted row id of a Concept table row. Concept has a sequential primary key called cid and an automatically generated sequence has appeared called Concept_cid_seq .
I try the following statement and get an error message:
SELECT currval("Concept_cid_seq"); ERROR: column "Concept_cid_seq" does not exist LINE 1: SELECT currval("Concept_cid_seq"); ^ ********** Error ********** ERROR: column "Concept_cid_seq" does not exist SQL state: 42703 Character: 16
But when I run the query:
SELECT * from "Concept_cid_seq";
I get a single row table (as you would expect) showing columns like last_value, start_value, etc.
What am I missing here? Am I passing wrong information to currval? Why does he say that "the column does not exist?"
source share