Skip to content

fix sequence nextval in default column #295

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmaresma
Copy link
Contributor

@dmaresma dmaresma commented May 2, 2025

Hi, I found a defect for a specific column default value when using a sequence

here the test
def test_table_with_sequence():
# test for
ddl = """CREATE TABLE table (
surrogatekey_SK NUMBER(38,0) NOT NULL DEFAULT DBTEST.SCTEST.SQTEST.NEXTVAL COMMENT 'Record Identification Number',
myColumnComment VARCHAR(255) COMMENT 'Record Identification Number from Sequence')"""
result = DDLParser(ddl).run(group_by_type=True)
expected = {
"ddl_properties": [],
"domains": [],
"schemas": [],
"sequences": [],
"tables": [
{
"alter": {},
"checks": [],
"columns": [
{
"check": None,
"comment": "'Record Identification Number'",
"default": "DBTEST.SCTEST.SQTEST.NEXTVAL",
"name": "surrogatekey_SK",
"nullable": False,
"references": None,
"size": (38, 0),
"type": "NUMBER",
"unique": False,
},
{
"check": None,
"comment": "'Record Identification Number from Sequence'",
"default": None,
"name": "myColumnComment",
"nullable": True,
"references": None,
"size": 255,
"type": "VARCHAR",
"unique": False,
},
],
"index": [],
"partitioned_by": [],
"primary_key": [],
"schema": None,
"table_name": "table",
"tablespace": None,
}
],
"types": [],
}
assert result == expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant