fn is_bigserial_default(default_value_expression: &str) -> bool
Expand description
Checks if a given default value expression is a BIGSERIAL default.
Normally, all unsupported expressions should fail in from_text
parsing.
However, we make a special exception for nextval()
function because:
- When users set a column as BIGSERIAL (usually as primary key), PostgreSQL automatically generates
a default value expression like
nextval('sequence_name'::regclass)
- This is a very common scenario in real-world usage
- For existing columns with
nextval()
default, we skip parsing the default value to avoid schema change failures
TODO: In the future, if we can distinguish between newly added columns and existing columns, we should modify this logic to:
- Skip default value parsing for existing columns with
nextval()
- Report error for newly added columns with
nextval()
(since they should be handled differently)