GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Wrong Diff query generation for a table with sequence · Issue #7165 · pgadmin-org/pgadmin4

Wrong Diff query generation for a table with sequence #7165

New issue
Copy link
New issue
Copy link
Closed
Closed
Wrong Diff query generation for a table with sequence#7165
Copy link
Assignees
JyotiEdb
Labels
Bug
Milestone
8.5

Description

@IAkumaI
IAkumaI
opened on Jan 29, 2024
Issue body actions

Describe the bug

Diff query for a table with sequence field does not work.

To Reproduce

Steps to reproduce the behavior:

  1. Create simple table:
CREATE TABLE public.example
(
    id bigserial,
    PRIMARY KEY (id)
);
  1. Make diff with the Diff toll of pgAdmin. Compare. Select both of the sequence and the table. Generate query script.
 BEGIN; 
 CREATE TABLE IF NOT EXISTS public.example
(
    id bigint NOT NULL DEFAULT nextval('example_id_seq'::regclass),
    CONSTRAINT example_pkey PRIMARY KEY (id)
)

TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.example
    OWNER to postgres;

CREATE SEQUENCE IF NOT EXISTS public.example_id_seq
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 9223372036854775807
    CACHE 1
    OWNED BY example.id;

ALTER SEQUENCE public.example_id_seq
    OWNER TO postgres;

 END;

Expected behavior

It works.

Error message

ERROR: relation "example_id_seq" does not exist
It's obvious you cant create table withou the sequence and, either, you can create sequence without the table, so the possible solution I see it to move OWNER BY from sequence ALTER after table creation.

Desktop (please complete the following information):

  • OS: MacOS Sonoma 14.2.1
  • Version: pgAdmin4
  • Mode: Desktop
  • Browser: Chromium 114.0.5735.91
  • Package type: Downloaded dmg

Activity

Next
  1. IAkumaI
    added
    Bug
    on Jan 29, 2024
  2. akshay-joshi
    added this to Not Refinedon Jan 30, 2024
  3. akshay-joshi
    added
    EDB Sprint 161
    on Jan 31, 2024
  4. akshay-joshi
    added this to Current Sprint (213) and removed this from Not Refinedon Jan 31, 2024
  5. akshay-joshi
    moved this to 🆕 New in Current Sprint (213)on Jan 31, 2024
  6. anilsahoo20
    self-assigned this
    on Feb 5, 2024
  7. anilsahoo20
    moved this from 🆕 New to 🏗 In Progress in Current Sprint (213)on Feb 5, 2024
  8. akshay-joshi
    added
    EDB Sprint 162
    and removed
    EDB Sprint 161
    on Feb 14, 2024
  9. anilsahoo20
    added 2 commits that reference this issue on Feb 14, 2024

    Fix an issue where the scripts created by generate script of Schema d…

    4cc4e9c

    Fix an issue where the scripts created by generate script of Schema d…

    79af2b4
  10. anilsahoo20
    moved this from 🏗 In Progress to In Review in Current Sprint (213)on Feb 14, 2024
  11. akshay-joshi
    added a commit that references this issue on Feb 15, 2024

    Fix an issue where the scripts created by generate script of Schema d…

    e81a036
  12. akshay-joshi
    moved this from In Review to In Testing in Current Sprint (213)on Feb 15, 2024
  13. 11 remaining items

  14. anilsahoo20
    moved this from 🏗 In Progress to In Review in Current Sprint (213)on Mar 11, 2024
  15. anilsahoo20
    added a commit that references this issue on Mar 12, 2024

    Fixed schema diff wrong query generation for table, foreign table and…

    82b0bad
  16. akshay-joshi
    added
    EDB Sprint 164
    and removed
    EDB Sprint 163
    on Mar 13, 2024
  17. akshay-joshi
    added a commit that references this issue on Mar 14, 2024

    Fixed schema diff wrong query generation for table, foreign table and…

    bece59d
  18. akshay-joshi
    moved this from In Review to In Testing in Current Sprint (213)on Mar 14, 2024
  19. akshay-joshi
    unassigned
    anilsahoo20
    on Mar 14, 2024
  20. akshay-joshi
    added this to the 8.5 milestone on Mar 14, 2024
  21. anilsahoo20 commented on Mar 18, 2024

    @anilsahoo20
    anilsahoo20
    on Mar 18, 2024
    Contributor
    More actions

    Please keep in mind, the below points while using the schema diff tool,

    1. Due to circular dependancies, the order in which Schema Diff writes the objects is not very sophisticated and may require manual changes to the script to ensure changes are applied in the correct order.
    2. When you are comparing two different schemas, the default value for a sequence is schema qualified, so it holds the source schema's name, change it to target schema name, if you want to assign it to target schema's sequence.
  22. anilsahoo20
    added a commit that references this issue on Mar 19, 2024

    Fix Table, Foreign Table SQL tab long query generation due to fix in …

    8114c30
  23. akshay-joshi
    added a commit that references this issue on Mar 19, 2024

    Revert the changes made to include a separate 'ALTER TABLE ...' query…

    cee0945
  24. akshay-joshi
    assigned
    JyotiEdb
    on Mar 19, 2024
  25. JyotiEdb commented on Mar 27, 2024

    @JyotiEdb
    JyotiEdb
    on Mar 27, 2024
    Contributor
    More actions

    Tested and verified on snapshot build:
    https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/2024-03-26/

  26. akshay-joshi
    closed this as completedon Mar 27, 2024
  27. akshay-joshi
    removed this from Current Sprint (213)on Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @JyotiEdb
    JyotiEdb

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    • 8.5

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.