|
- How do you create a read-only user in PostgreSQL?
postgres=# CREATE ROLE xxx LOGIN PASSWORD 'yyy'; postgres=# GRANT SELECT ON DATABASE mydb TO xxx; But it appears that the only things you can grant on a database are CREATE, CONNECT, TEMPORARY, and TEMP
- Postgres: INSERT if does not exist already - Stack Overflow
In Postgres version 9 5 or higher you can use ON CONFLICT to avoid errors of contraints like @Arie mentioned above To know more options related to this INSERT query refer to Postgres Docs An alternative solution is by using try catch to handle runtime errors
- sql - PostgreSQL IF statement - Stack Overflow
How can I do such query in Postgres? IF (select count(*) from orders) gt; 0 THEN DELETE from orders ELSE INSERT INTO orders values (1,2,3);
- Connecting to Postgresql in a docker container from outside
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres So now you have mapped the port 5432 of your container to port 5432 of your server -p <host_port>:<container_port> So now your postgres is accessible from your public-server-ip:5432 To test: Run the postgres database (command above)
- How to handle special characters in the password of a Postgresql URL . . .
URIs are supported by postgres since version 9 2 only, so with a 9 1 client that's not supposed to work at all Or you're using a client that implements connection URIs itself Percent-sign encoding is supported Per doc:
- updating table rows in postgres using subquery - Stack Overflow
Explanation: Sometimes we face the situation in that table join is so important to get proper data for the update To do so, Postgres allows us to Join multiple tables inside the FROM clause Approach-4 [Using WITH statement] 4 1 [Using simple query]
- postgresql - How to switch databases in psql? - Stack Overflow
If this parameter contains an = sign or starts with a valid URI prefix (postgresql: or postgres: ), it is treated as a conninfo string See Section 31 1 1, “Connection Strings”, in the documentation for more information
- What is the default password for Postgres - Stack Overflow
user:~$ sudo -i -u postgres postgres@user:~$ psql after executing above two commands you will get into postgres shell Execute this query in postgres shell: postgres=# ALTER USER postgres PASSWORD 'mynewpassword'; your new password is 'mynewpassword' without quotes and now you can connect with external GUI tools like DBeaver
|
|
|