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

postgresql constraints all get the same name #307

Open
torbjorn opened this issue Sep 13, 2021 · 2 comments
Open

postgresql constraints all get the same name #307

torbjorn opened this issue Sep 13, 2021 · 2 comments

Comments

@torbjorn
Copy link

It seems postgresql schemas get the same name for all constraints for a table (which obviously won't work)

I tried setting up a simple table with a id auto_increment primary key and a code text column that's unique:

This is what it generated:

    CREATE TABLE test (
     id BIGSERIAL,
     code TEXT NOT NULL
    );


    ALTER TABLE test ADD CONSTRAINT test_pkey PRIMARY KEY (id);
    ALTER TABLE test ADD CONSTRAINT test_pkey UNIQUE (code);

Notice how they are both named test_pkey. This does not work.

If I give the constraints specific names, it still doesn't change this behavior.

@p43k
Copy link

p43k commented Oct 27, 2021

my solution, maybe you can think of something similar ....;)
postgresql_keys-tunning.zip

@p43k
Copy link

p43k commented Nov 3, 2021

deal with default value:

<xsl:if test="default and not ( default = 'NULL' or default = &quot;'NULL'&quot; )">
<xsl:text> DEFAULT </xsl:text>
<xsl:value-of select="default" />
<xsl:text></xsl:text>
</xsl:if>

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

No branches or pull requests

2 participants