-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Describe the bug
A DDL containing COMMENT ON COLUMN does not associate the comment to the column
To Reproduce
run this:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from simple_ddl_parser import DDLParser
from pprint import pprint
parse_results = DDLParser("""-- something.t_spiel definition
-- Drop table
-- DROP TABLE something.t_spiel;
CREATE TABLE something.t_spiel (
id varchar(5) NOT NULL,
refprodid varchar(10) NULL,
titel varchar(100) NOT NULL,
refsaalid varchar(10) NULL, -- Verweis auf den Saal
freieplatzwahl bool NOT NULL DEFAULT true, -- Ja/Nein
CONSTRAINT idx_t_spiel_primary PRIMARY KEY (id)
);
-- Column comments
-- COMMENT ON COLUMN something.t_spiel.refsaalid IS 'Verweis auf den Saal';
-- COMMENT ON COLUMN something.t_spiel.freieplatzwahl IS 'Ja/Nein';
-- something.t_spiel foreign keys
ALTER TABLE something.t_spiel ADD CONSTRAINT "foreign_key_Ref_Prod_Id" FOREIGN KEY (refprodid) REFERENCES something.t_produktion(id);
ALTER TABLE something.t_spiel ADD CONSTRAINT "foreign_key_Ref_Saal_Id" FOREIGN KEY (refsaalid) REFERENCES something.t_saal(id);
""",silent=True).run(output_mode='sql')
pprint(parse_results)
This code produces
... {'comments': [' Verweis auf den Saal', ' Ja/Nein']}...
which is just a collection of comments w/o reference to the fields they belong to.
Expected behavior
something like
{'comments': {'something.t_spiel.refsaalid': ' Verweis auf den Saal', 'something.t_spiel.freieplatzwahl': ' Ja/Nein'}}...
should be generated, or even better for postprocessing, the comment should be added to the field description:
{'check': None,
'default': None,
'name': 'refsaalid',
...
'comment': 'Verweis auf den Saal' },
Desktop (please complete the following information):
- Database: Postgresql
- DDL created with DBeaver
jochenchrist
Metadata
Metadata
Assignees
Labels
No labels