1,124 questions
0 votes
1 answer
86 views
Select only distinct values from two tables on pgadmin without getting all combinations
I have two tables. table 1 Column A Column B rgz 1 dry 1 vgy 2 chy 3 pom 2 table 2 Column C Column D tuv 10 tuv 11 chx 22 lmn 34 I want the following result shown on data output of postgres PgAdmin ...
0 votes
1 answer
94 views
Alter entries of Primary key in table to match number of rows from COUNT Postgresql
We have the definition of the table below CREATE TABLE Log ( LogId serial not null, JobId integer not null, Time timestamp without time zone,...
-2 votes
2 answers
53 views
Merge two rows with both possibly being null
In PostgreSQL, I have a table with some settings the user can make. In that table there is also a "global" user that takes place if the user doesn't have any settings for them. This query ...
0 votes
1 answer
107 views
postgres database recovery - version 9.2
I get hacked by several tables dropping for the postgres database. It is on a cloud ECS environment. During the hack, I realized the attack and created a snapshot but unfortunately I still have ...
1 vote
1 answer
2k views
Upgrading PostgreSQL 9.2.15 to 16.1 - Incremental Version Updates?
I'm dealing with an older PostgreSQL database running on version 9.2.15. I aim to upgrade it to the latest version 16.1 without losing data if possible. Should I perform incremental updates to major ...
0 votes
2 answers
308 views
Need help configuring PostgreSQL connection to behave like MySQL: Connect to server without auto-selecting default database
In mysql when I enter the following mysql -u root -p Password: enter password successfully I then get into my local server and from here I can view all my databases using SHOW DATABASES. But when I ...
0 votes
0 answers
56 views
User's Online Time and Period with no Users Online
Hello good people of stackoverflow! I need help with writing a query, to identify online time grouped by users, and also to identify which are the periods where there were 0 users online and for how ...
0 votes
0 answers
493 views
How to configure Postgres to never rotate or truncate a log file?
I have a very very old Postgres version 9.2.23 DB that has very little log activity. I want to prevent any logs from being deleted. Currently the log_collector is configured to rotate the logs every ...
1 vote
1 answer
361 views
insert if update subquery returns 0 rows
Specs: PostgreSQL 9.2.18 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit I'm on MacOS 13.2.1, using DBeaver IDE (version 23.0.4.202305071722) to connect to ...
0 votes
2 answers
100 views
Pre-define groups for PostgreSQL query
my_events table stores event_id, event_date, event_type, event_duration. There are many event types for example: Event A, Event B, Event C, Event D The query that I have written will get my results ...
7 votes
0 answers
8k views
Upgraded pgAdmin shows warning, not displaying Tables list, queries working without problem
I upgraded my local Postgresql test server to PostgreSQL15 today morning. Opening pgAdmin gave me a warning that some of the features may not work correctly because I have a server with version 9 ...
0 votes
0 answers
958 views
pg_ctl: directory "C:/Program Files/PostgreSQL/13/data" does not exist The reload command returned an error (1)
When I try to open "pg_hba.conf" file, keep getting the following error: pg_ctl: directory "C:/Program Files/PostgreSQL/13/data" does not exist The reload command returned an ...
0 votes
1 answer
238 views
Unable to query a table in hive metadata
I am not able to query the contents of the Notification_log table. The table is in a Postgres 9.2 instance that stores my hive metadata. hive=# SELECT table_catalog, table_schema, table_name FROM ...
0 votes
0 answers
156 views
Postgis/Postgresql join 3 tables
I'm a complete beginner to Postgresql and Postgis and I can't figure how to do this: I have 3 tables, T1, T2 and T3. T1 and T2 have ID as common column. T2 and T3 can be joined on the geom column. T1 ...
0 votes
1 answer
361 views
How to compare a value against a column value containing csv in Postgres?
I have a table called device_info that looks like below (only a sample provided) device_ip cpu memory 100.33.1.0 10.0 29.33 110.35.58.2 3.0, 2.0 20.47 220.17.58.3 4.0, 3.0 23.17 30.13.18.8 -1 26.47 70....