I am new to postgres
, and I am using Visual Studio Code IDE (version 1.62) to write my scripts.
While doing so, I am observing this strange behaviour where VS Code doesn’t highlight the data type smallserial
(2 bytes).
Here is what I see:
But I know that the script is correct because this query runs successfully. How can I get the proper highlighting here?
Advertisement
Answer
That’s probably because smallserial
(like serial
or bigserial
) are not actual data types. See:
- How to convert primary key from integer to serial?
- Safely rename tables using serial primary key columns
In Postgres 10 or later, consider an IDENTITY
column instead. See:
If serial
and bigserial
are highlighted, but smallserial
is not, then that’s inconsistent and should be fixed.