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

Postgres 10 Sequence support #225

Closed
kuvasz-io opened this issue Oct 30, 2017 · 11 comments
Closed

Postgres 10 Sequence support #225

kuvasz-io opened this issue Oct 30, 2017 · 11 comments

Comments

@kuvasz-io
Copy link

Dumps created with Postgres 10 that contain Sequences crash apgdiff.

Postgres 9.x dumps sequences like this:

CREATE SEQUENCE alert_alert_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

Postgres 10 adds a "AS integer"

CREATE SEQUENCE alert_alert_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

This is refused by apgdiff

Exception in thread "main" cz.startnet.utils.pgdiff.parsers.ParserException: Cannot parse string: CREATE SEQUENCE alert_alert_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
Unsupported command at position 40 'AS integer
    START'
	at cz.startnet.utils.pgdiff.parsers.Parser.throwUnsupportedCommand(Parser.java:390)
	at cz.startnet.utils.pgdiff.parsers.CreateSequenceParser.parse(CreateSequenceParser.java:80)
	at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:183)
	at cz.startnet.utils.pgdiff.loader.PgDumpLoader.loadDatabaseSchema(PgDumpLoader.java:236)
	at cz.startnet.utils.pgdiff.PgDiff.createDiff(PgDiff.java:29)
	at cz.startnet.utils.pgdiff.Main.main(Main.java:39)
olasd added a commit to olasd/apgdiff that referenced this issue Nov 3, 2017
olasd added a commit to olasd/apgdiff that referenced this issue Nov 3, 2017
@olasd
Copy link

olasd commented Nov 3, 2017

(Sorry for the noise, wrong email)

Just throwing my patch for this issue over the wall as I needed a quick fix for work. Still needs a test update, feel free to pick it up or I'll do that when I get more time. :)

@shemgp
Copy link

shemgp commented Nov 13, 2017

I can confirm that olasd's patch works.

@chadfurman
Copy link
Collaborator

Anyone want to open a PR and I can merge that into the develop branch?

@jalissonmello
Copy link
Contributor

Hi, I opened the PR with olasd's code and also added the changes to support alter sequence data_type .

Would be interesting if someone else confirmed that this PR works.

If you still need adjustments tell me that I ll be glad to make the changes

@iyobo
Copy link

iyobo commented Apr 10, 2018

Has this been merged to master yet?

@jalissonmello
Copy link
Contributor

Not yet

@jflambert
Copy link

Am I missing something here or is the real issue "apgdiff does not support PostgreSQL 10"?

In other words is there a workaround, like ignoring sequences?

@valoricDe
Copy link
Collaborator

@jflambert, @iyobo Are you able to build apgdiff and test the changes made in #228 Should be fixed with the changes

@shujare
Copy link

shujare commented Feb 5, 2019

@olasd I am also facing same issue ..How can I get jar for this issue 225.

@valoricDe
Copy link
Collaborator

The jar mentionend in #241 contains the fix

@shujare
Copy link

shujare commented Feb 5, 2019

Thank you very much @valoricDe. Its working now.

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

9 participants