0

I have an enum datasetId, to which I'd like to add another value.

However, this doesn't work:

ALTER TYPE datasetId ADD VALUE 'SOME_VALUE'

and fails with

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedObject) type "datasetid" does not exist

I believe this is because of the uppercase letter in the enum name. How to I get around that?

KarloSpacapan
  • 173
  • 2
  • 16

1 Answers1

2

"I believe this is because of the uppercase letter in the enum name." -- Enclose identifiers with special characters or where casing matters in double quotes:

ALTER TYPE "datasetId" ADD VALUE 'SOME_VALUE';

Or, the recommended way, just don't use identifiers with special characters or meaningful casing at all. At the end of the day they're just annoying.

sticky bit
  • 36,626
  • 12
  • 31
  • 42