Correct PostgreSQL functionality [duplicate] - postgresql

This question already has answers here:
In psql, why do some commands have no effect?
(2 answers)
Closed 6 years ago.
I have installed Postgres.app in Mac, and I have set the PATH variable to run the psql command.
Now I would like to create a new user and new database for a project that I'm creating. Nevertheless, when I execute a new command in terminal, it doesn't prompt me anything, and I don't know if my command was executed correctly.
Even if I write dummy words, it doesn't tell me anything:
Also, if I want to enter to the postgres user, it doesn't allow me, sending me the next error:
Does anyone know what is happening?.
Regards.

You have to append ; to each of your PostgreSQL - commands.

Related

PGAdmin restore remote database [duplicate]

This question already has answers here:
Export and import table dump (.sql) using pgAdmin
(6 answers)
Closed 1 year ago.
Let I first state that I am not a DBA-guy but I do have a question regarding restoring remote databases using PG Admin.
I have this PG Admin tool (v4.27) running in a Docker container and I use this portal to maintain two separate Postgress databases, both running in a Docker container as well. I installed PG Agent in both database containers and run scheduled daily backup's, defined via PG Admin and stored in the container of each corresponding databases. So far so good.
Now I want to restore one of these databases by using the latest daily backup file (*.sql), but the Restore Dialog of PG Admin only looks for files stored locally (the PG Admin container)?
Whatever I tried or searched for on the internet, to me it seems not possible to show a list of remote backup files in PG Admin or run manually a remote SQL file. Is this even possible in PG Admin? Running psql in the query editor is not possible (duh ...) and due to not finding the remote SQL-restore file I have no clue how to run this code within PG Admin on the remote corresponding database container.
The one and only solution so far I can think of, is scheduling a restore which has no calendar and should be triggered manually when needed, but it's not the prettiest solution.
Do I miss something or did I overlook the right documentation or have I created a silly, unmaintainable solution?
Thanks in advance for thinking along and kind regards,
Aad Dijksman
You cannot restore a plain format dump (an SQL script) with pgAdmin. You will have to use psql, the command line client.
COPY statements and data are mixed in such a dump, and that would make pgAdmin choke.
The solution by #Laurenz Albe points out that it is best to use the command line psql here, and that would be my first go-to.
However, if for whatever reason you don't have access to the command line and are only able to connect to this database via pgadmin, there is another solution which you can find here:
Export and import table dump (.sql) using pgAdmin
I recommend looking at the solution by Tomas Greif.

Database is not creating in postgres (psql) [duplicate]

This question already has answers here:
In psql, why do some commands have no effect?
(2 answers)
Closed 2 years ago.
I downloaded postgresql installer version 11 from official website for windows.
when i enter psql and try to create database , database doesn't get created but it is creating by pgadmin4 with no problem
You are missing a semi-colon at the end of the line. You need to run:
CREATE DATABASE demo;
you miss semicolon on the end of command.
you should to write CREATE DATABASE demo;
psql by default allows multilines statements, so any statement should be finished by special character and it is semicolon ;

postgresql: how to use a particular database [duplicate]

This question already has answers here:
How to switch databases in psql?
(15 answers)
Closed 8 years ago.
I am quite new to postgresql and I am looking to timprove. I mostly use MySQL and from what I see already there are a few differences. Under mysql i would want to use or change my database (d1), i simply say the command
use d1;
What do I do under postgres?
I can view the databases and roles using commands such as:
select * from pg_roles;
select datname from pg_database;
Also are there comprehensive online resouces that I can point to?
Thanks
Psql uses short commands prefixed by a backslash to identify 'meta-commmands'; inputs that are for the command shell and not commands to be sent to the database.
You can get a list of these by typing \?
You can change databases in psql by using \c databasename
Here's the psql documentation for the newest release

How to recover from LispCabinet error "the server directory is unsafe"? [duplicate]

This question already has answers here:
Emacs - Error when calling (server-start)
(11 answers)
Closed 9 years ago.
I installed LispCabinet and after the first start it tells me:
server-ensure-safe-dir: The directory `c:/Documents and Settings/Administrator/ApplicationData/.emacs.d/server' is unsafe
What does this mean, how did it come, is it dangerous and what can I do about it?
I am working on a windows account with administrator permissions. The server directory in emacs.d was owned by the group "Administrators". I changed the ownership from the user group "Administrators" to be owned by the username I am currently working with (which is "Administrator") and the error message went away.
This solution is quite similar to the one given in this answer: https://stackoverflow.com/a/2944197/1312456

db2 Type 4 driver downlaod [duplicate]

This question already has an answer here:
Closed 12 years ago.
Possible Duplicate:
db2 Type 4 driver downlaod
Hi to all,
I want to connect to the Db2 data base server with java application, I use type4 driver, can you please tell me exact location to download DB2 Type4 driver
Thanq in advance
The actually recommended way is to get this from the DB2 server you are working with because it quarantees you get the correct version of them. You can find them from /sqllib/java .