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

Deparse constraints #28

Merged
merged 3 commits into from
Aug 24, 2015
Merged

Conversation

JackDanger
Copy link
Contributor

This PR adds deparsing of complex types (like interval day to second(2)) and constraints on table creation.

e.g. "CONSTRAINT name_length PRIMARY KEY (name, length)"
This one is a bit tricky. PG packs the interval parts into a single
integer and it does so according to a very specific set of combinations
enumerated in the grammar. There was no straightforward way to recompose
the original SQL - we have to use a map of known values.
def self.from_int(int)
SQL_BY_MASK[int]
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👌

This reminds me, we should split the deparsing into multiple files (based on node type).

lfittl added a commit that referenced this pull request Aug 24, 2015
@lfittl lfittl merged commit 84c0c03 into pganalyze:master Aug 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants