1

How can I make cmd psql and pgAdmin 4 database sync? because they don't sync. cmd psql outputs postgres, template 01, and template 02 as db, while my pgAdmin4 outputs postgres and SampleDB as my databases.

psql output:

enter image description here

pgAdmin display:

enter image description here

pgAdmin inet:

enter image description here

cmd inet cmd inet

Karl Garcia
  • 45
  • 11
  • 1
    If you see different data in pgAdmin and psql then you are connecting to two different databases (or even servers). Or if you did changes in one tool but they don't show up in the other tool, then maybe you simply forgot to `commit` them? –  Sep 18 '18 at 08:40
  • when I create database in both medium, they don't reflect in each other, they separate. lol. Idk if you understand that. check question, I uploaded images. Thanks – Karl Garcia Sep 18 '18 at 08:55
  • Please show us the output of `select inet_server_addr()` run from inside `psql` and run from within pgAdmin. –  Sep 18 '18 at 08:55
  • sorry but how to run it in psql? it says error here. – Karl Garcia Sep 18 '18 at 09:06
  • You just run `select inet_server_addr();` https://i.imgur.com/9C22HF7.png –  Sep 18 '18 at 09:11
  • updated. sorry for late reply – Karl Garcia Sep 19 '18 at 14:13
  • They both run on the same server 1. please help, I want to manipulate my database in pgAdmin because of it's UI. – Karl Garcia Sep 20 '18 at 02:43
  • Any answers now? :( – Karl Garcia Sep 21 '18 at 03:48

2 Answers2

0

I don't know the issue you are facing and what are you trying to achieve. do you want to do psql command and not in the gui PgAdmin4 where you can do more easily?

Here i am make new 3 database from pgAdmin4 and psql command

  1. From PgAdmin4 gui and the database name warehouses

  1. From psql command doing with owner name warehoused1

And as you can see in pic 2 the result it show the database too

  1. From psql command just create database without owner (default) name warehoused2

And see the result? no problem at all. Now see in PgAdmin4

It shows too in PgAdmin4. I can't give the solution because i don't know the issue you are facing.

Edit : The reason you have different result in your psql and pgAdmin because you have 2 postgresql in your system and your path lead to other postgresql it means your psql connect to different server.

dwir182
  • 1,539
  • 10
  • 20
  • Thanks for noticing my question! My problem is that my pgAdmin and my psql don't sycn with each other. When I create a database in pgAdmin4 it doesn't reflect in my psql cmd line. and vice versa. they are separated. I want it to be like your. to sync data with each other. How can I fix it to do that? because mine are separated after installation. Many thanks! – Karl Garcia Sep 22 '18 at 09:46
  • Do you have 2 postgres in your server? – dwir182 Sep 22 '18 at 12:17
  • I don't know about that. how to check? – Karl Garcia Sep 24 '18 at 01:12
  • What os your server using? if windows check program files and find postgresql installation there – dwir182 Sep 24 '18 at 01:14
  • See the path in environment variables in properties computer. https://www.computerhope.com/issues/ch000549.htm and after that see in path system variable and find path postgresql. is the path postgresql refer to your installation. the path postgresql should be like `C:\Program Files\PostgreSQL\10\bin` – dwir182 Sep 24 '18 at 01:47
  • Doesn't seem to help. tho I notice 2 postgreSQL in my C drive, one in C:\PostgreSQL and the other in C:\Program Files\PostgreSQL. can't delete cuz it says in use. will try uninstalling it. – Karl Garcia Sep 24 '18 at 02:50
  • That's the reason.. You can do psql command in cmd because you using path. if your path refer to other postgresql your using then that is your problem. like a_horse_with_no_name said. you connect to different server. – dwir182 Sep 24 '18 at 02:54
  • and don't ever do delete on program you are using. if you want to remove just uninstall. if you just delete that's the worse way! – dwir182 Sep 24 '18 at 02:56
  • Solve. unsintalled both and install only one and restarted computer. deleted appData/roaming/pgAdmin and postgreSQL folder. pls post an answer so I can Check. thanks! I'm so happy problem is solved. took days xD – Karl Garcia Sep 24 '18 at 03:37
  • Please mark my answer so people know your problem is solved. :) – dwir182 Sep 24 '18 at 06:40
0

Solved!

Turns out I have 2 postgreSQL installed.

Uninstalled both and install only one and restarted computer. deleted appData/roaming/pgAdmin and postgreSQL folder.

Karl Garcia
  • 45
  • 11