pgdiff icon indicating copy to clipboard operation
pgdiff copied to clipboard

pgdiff outputs no sql

Open neoneye opened this issue 7 years ago • 1 comments

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:[email protected]:5432/test1b  --command 'SELECT * FROM people'
 id  | name  
-----+-------
   1 | 1b_1
   5 | 1b_5
 100 | nvidia dgx-2
(3 rows)

PROMPT> psql postgresql://johndoe:[email protected]: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:[email protected]: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:[email protected]: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>

neoneye avatar Apr 01 '18 13:04 neoneye

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

joncrlsn avatar Apr 02 '18 01:04 joncrlsn