Category "postgresql"

Grafana group series

I have postgres table with three variables: datetime, robot_id and energy_percent. Now at chart I have energy_percent and robot_id. How to group records from th

How to get value printed on Postgres

I have a requirement to translate it to an SQL script. I am using the information schema to get all the columns of a table and print their distinct count. I was

Draw sector by center point, radius, interior angle and azymuth in postgis

I'm building a javascript application using Bing Maps API, and I would like to make up sector geometries from center points and sector parameters. I have a tabl

How to redistribute sum of specific months to another month via psql

I have a transactional table with year, month and amount. Now, there are months which we consider non-operating months (jan, feb, dec). However, SAP automatical

Tired of creating /run/postgresql and setting read and execute writes after every reboot

I'm running Arch Linux, I installed PostgreSQL as any other arch package. I'm running postgres with a local database located in my user directory. (postgres -D

No schema has been selected to create in ... error

I am working on a Linux server that is hosted on Amazon's server and I have completely set up the server. The final thing I am trying to do is host one of my ol

Postgres - command not found

I'm trying to setup a working test DB with postgreSQL 13 by following a tutorial but I'm completely confused about which command really exists and which does no

How to bulk insert in psql using knex.js?

I've searched a lot and this is deprecated question. I'm trying to bulk insert in a table. My approach was like this knex('test_table').where({ user: 'user@ex

How to get only those objects whose subarrays in the arrays match the requested one with SQL and Hibernate?

I have Project objects that contain arrays of Tags (for example, Backend, Frontend, Sales, Marketing). The user sets the desired parameters, such as Backend and

Postgreql wal archive keeps failing: archive command failed with exit code 1

I have a file that keeps failing to archive. The failed archive command was: test ! -f /mnt/wal_archive/archivedir/00000001000003F000000072 && cp pg_wal

Upgrade to postgres 10 wanting to use checksums

I have a postgresql 9.3 instance that I am wanting to upgrade to postgresql 10. I have a command that I think should work but it includes checksums in it. My ol

Why role cannot be dropped because some objects depend on it

Database "mydb" is owned by role "mydb_owner". User "currentuser" tries to delete role "roletodelete" from this database using revoke all on all tables in

Indexes not working after Postgresql Upgrade (10.18 -> 11.14)

Solved: Doing a vacuum on all of the old tables resolved the index issues. Autovacuum was never going to happen because they were all static. Simplest query tha

insert or update on table "django_admin_log" violates foreign key constraint

Trying to save a post on a django project I got this error The above exception (insert or update on table "django_admin_log" violates foreign key constraint "dj

PostgreSQL C function to get values

I am trying to write a PostgreSQL function in C. My goal is finding minimum value of a list. So, my function will be executed like these: SELECT min_to_max(val)

PostgreSQL 13 - Performance Improvement to delete large table data

I am using PostgreSQL 13 and has intermediate level experience with PostgreSQL. I have a table named tbl_employee. it stores employee details for number of cust

Find first record of multiple values in single query

Table timestamp | tracker_id | position ----------------------------------+------------+---------- 2020-02-01 21:53:45.571429+05:30 |

Turn postgres date representation into ISO 8601 string

I'm trying to format a Postgres date representation into a ISO 8601 string. I'm assuming that there is a Postgres function that can do it, but I found the docum

I am unable to install PostgreSQL 12 on Red Hat 8.1 after following official instructions using dnf

Official Instructions I have been trying to install PostgreSQL 12 but I get the following error: No match for argument: postgresql12 Error: Unable to find a mat

union all in SQL (Postgres) mess the order

I have a query which is order by date , there is the query I have simplified it a bit but basically is : select * from (select start_date, to_char(end_date,