Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
0 answers
22 views

Programmatically create a Role with Permissions within pgAdmin’s internal user management

I am asking about pgAdmin internal user management, not Postgres users-and-roles. For teaching a beginning database class, I am trying to procedurally configure pgAdmin in Server Mode, using shell ...
Basil Bourque's user avatar
0 votes
1 answer
156 views

Help with creating postgres databases with - in the name

I'm currently trying to script some migration of databases on a server. As part of this process I will need to create a new database with a similar name to the existing database. Whilst I have this ...
Mr-F's user avatar
  • 101
0 votes
1 answer
104 views

How to rapidly compare definitions of many tables of two PostgreSQL databases?

I have two PostgreSQL databases, the one for producing, and the other for testing. Both of them have a lot of tables with same table names. Now I need to upgrade the producing system to the new ...
Leon's user avatar
  • 413
1 vote
1 answer
626 views

Set 'timing on' for the duration of the current `psql` session using command-line options

What is the equivalent of \timing on command in psql, using the psql command-line options? I am aware that this will enable timing for all psql sessions: echo '\\timing on' >> ~/.psqlrc I am ...
Timur Shtatland's user avatar
-1 votes
2 answers
320 views

Is there a short script to safely perform a major-release upgrade on a postgreSQL docker container?

The question specifically focuses on the assumed required upgrade of the data structures when stepping up to the next or even latest major release. I know it usually involves dumping the data before ...
datenheim's user avatar
  • 123
2 votes
1 answer
11k views

Run PSQL command from bash script

I would like to know how to run \du within a script, and output that to a file. Something like the following: # some_script.sh psql <database connection> & \du > output_of_du.txt I can ...
baxx's user avatar
  • 326
0 votes
2 answers
68 views

How to query 30k of entries from an external data source by script

I have a SQL query which works for single checks: SELECT trans_id from schema.table where trans_id like '%<trans_id>%' There're might be better approaches to query for, but that's not the point. ...
dbalucas's user avatar
1 vote
1 answer
4k views

Run both of "DROP DATABASE" and "CREAT DATABASE" in CLI with "-c" option of psql of Postgresql

When debugging programs, I need to frequently drop a database of Postgresql, and then re-create it again. To convenient, I want to execute this in a single command line like following: psql -c "...
Leon's user avatar
  • 413
0 votes
0 answers
70 views

Create dadabase with spesific encoding from shell script

I want to create a database from shell script, I add this line to my script psql -c 'CREATE DATABASE template1 WITH OWNER = postgres ENCODING = 'LATIN1' TABLESPACE = pg_default LC_COLLATE = "...
user3093583's user avatar
1 vote
1 answer
8k views

Postgres how do return a message if no results for SELECT query

Have been trying to work out how to return a message if the result is empty. I am running a select statement as below: select * from maxIDValue where max_value > 1000000 order by max_value desc; I ...
rdbmsNoob's user avatar
  • 459
1 vote
1 answer
905 views

How to generate constraint sql?

I'm looking for a method that can generate the creating sql, like PgAdmin's SQL tab while having selected the constraint. (how pg admin does it?) I want to implement a generic method that can drop and ...
cdalxndr's user avatar
  • 161
2 votes
3 answers
10k views

Postgresql Backup all databases separate files

I need to create an automatic backup of all databases from PostgreSQL (running on a Windows machine). I need to know if it is possible to get a backup of all databases but in separate files. Using ...
Anisa Ibro's user avatar
6 votes
5 answers
36k views

What does "psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (required by psql)" actually mean?

I have a question regarding following output: [nikola@192 ~] $ sudo su - postgres [postgres@192 ~] $ psql dvdrental postgres psql: /usr/pgsql-11/lib/libpq.so.5: no version information available (...
NikolaS's user avatar
  • 272
12 votes
1 answer
12k views

PostgreSQL - How to list all foreign key link to Primary key of a table

I have a table res_users with primary key id I would like to list all the foreign key link to id from all the tables in my database.
tuanngocptn's user avatar
0 votes
2 answers
8k views

output psql results and errors to a file

I want to display the results of psql queries on a file.In the log just the name DO for the anonymous Bloc is being displayed. The following is being executed from a shell script file : psql --host=...
unknownUser's user avatar

15 30 50 per page