Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change CREATE TABLE DEFAULT constraint handling #561

Merged

Conversation

andrew-farries
Copy link
Collaborator

Change how CREATE TABLE statements like:

CREATE TABLE foo(a int DEFAULT NULL)

are converted to OpCreateTable operations.

When a column has a default value of NULL, the default field in the resulting Column object should be omitted, rather than set to "NULL".

This makes conversion of CREATE TABLE statements consistent with conversion of ALTER TABLE ADD COLUMN statements.

@andrew-farries andrew-farries marked this pull request as ready for review December 20, 2024 08:58
@andrew-farries andrew-farries added the sql2pgroll Issues relating to the sql2pgroll package label Dec 20, 2024
@andrew-farries andrew-farries changed the base branch from main to fix-initially-immediate-constraints December 20, 2024 11:40
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch 2 times, most recently from bd13dde to 6637821 Compare December 20, 2024 11:43
@andrew-farries andrew-farries force-pushed the fix-initially-immediate-constraints branch from 5b04017 to ec79280 Compare January 2, 2025 09:09
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from 6637821 to 19aff38 Compare January 2, 2025 09:09
@andrew-farries andrew-farries force-pushed the fix-initially-immediate-constraints branch from ec79280 to c7eaa68 Compare January 2, 2025 09:15
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from 19aff38 to cef3018 Compare January 2, 2025 09:15
@andrew-farries andrew-farries force-pushed the fix-initially-immediate-constraints branch from c7eaa68 to 1957ed9 Compare January 2, 2025 09:20
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from cef3018 to f03b847 Compare January 2, 2025 09:20
Base automatically changed from fix-initially-immediate-constraints to main January 2, 2025 09:27
When a column has a default value of `NULL`, the `default` field in the
resulting `Column` object should be omitted, rather than set to
`"NULL"`.

This makes conversion of `CREATE TABLE` statements consistent with
conversion of `ALTER TABLE ADD COLUMN` statements.
@andrew-farries andrew-farries force-pushed the change-create-table-default-constraint-handling branch from f03b847 to 48ea17e Compare January 2, 2025 09:27
@andrew-farries andrew-farries merged commit 1038bc2 into main Jan 2, 2025
28 checks passed
@andrew-farries andrew-farries deleted the change-create-table-default-constraint-handling branch January 2, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql2pgroll Issues relating to the sql2pgroll package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants