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

pgdiff outputs no sql #28

Open
neoneye opened this issue Apr 1, 2018 · 1 comment
Open

pgdiff outputs no sql #28

neoneye opened this issue Apr 1, 2018 · 1 comment

Comments

@neoneye
Copy link

neoneye commented Apr 1, 2018

Hi, it's a cool tool you have.

When I run this command

PROMPT> pgdiff COLUMN -U johndoe -H 127.0.0.1 -D test1  -O "sslmode=disable" -S 'public' -P 5432 -W "password" -u johndoe -h 127.0.0.1 -d test1b -o "sslmode=disable" -s 'public' -p 5432 -w "password"
-- schemaType: COLUMN
-- db1: {test1 127.0.0.1 5432 johndoe password public sslmode=disable}
-- db2: {test1b 127.0.0.1 5432 johndoe password public sslmode=disable}
-- Run the following SQL against db2:

then no SQL is outputted.

The databases have a single table with slightly different content, so I would expect some kind of output. I have also tried with TABLE, but no luck.

Here is info about my setup. Hopefully helpful.

Table Content (different)

The table content of the databases are like this:

PROMPT> psql postgresql://johndoe:password@127.0.0.1:5432/test1b  --command 'SELECT * FROM people'
 id  | name  
-----+-------
   1 | 1b_1
   5 | 1b_5
 100 | nvidia dgx-2
(3 rows)

PROMPT> psql postgresql://johndoe:password@127.0.0.1:5432/test1  --command 'SELECT * FROM people'
 id  | name  
-----+-------
   1 | 1_1
   7 | 1_7
 100 | nvidia dgx-2
(3 rows)

PROMPT>

Table definition (same)

The people table is described like this:

PROMPT> psql postgresql://johndoe:password@127.0.0.1:5432/test1b
psql (9.6.5)
Type "help" for help.

test1b=# \d people
    Table "public.people"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 name   | text    | 

test1b=# \q
PROMPT> psql postgresql://johndoe:password@127.0.0.1:5432/test1
psql (9.6.5)
Type "help" for help.

test1=# \d people
    Table "public.people"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 name   | text    | 

test1=# \q
PROMPT>

Database user

The johndoe is a superuser created like this:

CREATE USER johndoe;
ALTER USER johndoe WITH PASSWORD 'password';
ALTER USER johndoe WITH SUPERUSER;
GRANT ALL PRIVILEGES ON DATABASE test1 to johndoe;
GRANT ALL PRIVILEGES ON DATABASE test1b to johndoe;

Environment

PROMPT> psql --version
psql (PostgreSQL) 9.6.5
PROMPT> uname -a
Darwin revision_demoparty2018.lan 17.3.0 Darwin Kernel Version 17.3.0: Thu Nov  9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64 x86_64
PROMPT>
@joncrlsn
Copy link
Owner

joncrlsn commented Apr 2, 2018

Hi Simon, Thanks for the question. I like how you have it boiled down to a simple example showing your problem.

Your schema between the two databases matches so it will not show a difference. Pgdiff doesn't compare data, just the schema. If you rename a column (or add a new one) on one of the databases you will get some output.

  • Jon

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