sqlpostgresqlpostgres-10

Weird error: relation <schema name> does not exist


I am running a DDL statement like this in Postgres 11

ALTER SEQUENCE kwt.VisitReport_seq OWNED BY kwt.VisitReport;

I am running it as DBADMIN.

Yet I get some weird error:

SQL Error [42P01]: ERROR: relation "kwt" does not exist ERROR: relation "kwt" does not exist ERROR: relation "kwt" does not exist

But this is strange... kwt is not a relation, it is a schema.

What is going on?!


Solution

  • As often happens right after posting here I found the problem.

    The statement should be:

    ALTER SEQUENCE kwt.VisitReport_seq OWNED BY kwt.VisitReport.ID;

    i.e. it should refer (of course) to the column name, not to the table name.