Category "postgresql"

Can PostgreSQL array be optimized for join?

I see that PostgreSQL array is good for performance if the array's element is the data itself, e.g., tag http://shon.github.io/2015/12/21/postgres_array_perform

What is the purpose of views' predefinitions in dump file

I'm working on the project where we are using :sql schema format for the Active Record dumper (to support more complex logic like triggers). We have a lot of

How can I run an ad-hoc script in PostgreSQL?

I'm trying to run this in PostgreSQL 9.2: RAISE NOTICE 'Hello, World!'; And the server says: Error : ERROR: syntax error at or near "RAISE" LINE 1: RAISE NOTI

Nearest location from JSON column

We have a directory application and every directory has many branches and many location points (latitude, longitude) The branches location are stored in the dat

postgresql duplicate key violates unique constraint

I have a question I know this was posted many times but I didn't find an answer to my problem. The problem is that I have a table and a column "id" I want it to

Backend docker image does not wait until db becomes available

I am trying to docker-compose up my containers, one for backend and another one for the database (postgis). If I docker-compose up db, I see db_1 | 2021-11-23

Query returns function plus the value inside instead of just the value

I'm running a select query and for fetching date and time data from the database but for some reason the returned value is datetime.date(2021, 11, 18) and datet

Check the perm 'Create Database' in PostgreSQL as well as in SQL Server

I would like to check the perm in PostgreSQL db as well as I do it via this command 'SELECT HAS_PERMS_BY_NAME(NULL, 'DATABASE', 'CREATE DATABASE')' for the SQL

Will TypeORM @AfterRemove or @BeforeRemove entity listeners still run when the db is dropped?

Some entities in my database have a property which is their associated key on AWS S3, for example: // my.entity.ts @Column() s3Key: string; I would like one of

recursive tree as a list (array items) in a new attribute value child

How to get hierarchy data(recursive tree) as a new column like below? (if there is last child then column child array is empty) rows: [{ 'id' : 1, 'paren

Printing to the screen in a .sql file in PostgreSQL

I have a .sql file I am building for an upgrade to my application that alters tables, inserts/updates, etc. I want to write to the screen after every command fi

Spark streaming jdbc read the stream as and when data comes - Data source jdbc does not support streamed reading

I am using PostGre as database. I want to capture one table data for each batch and convert it as parquet file and store in to s3. I tried to connect using JDB

Filter jsonb results in subselect

I'm building a hierarchical JSON result from several tables. These are just examples but should be sufficient for the purpose of this demonstration to get the i

Postgres backup as tar.gz

I'm trying to backup Postgres with pg_dump. pg_dump $POSTGRES_DB -U postgres > $POSTGRES_DB-$(date +%d-%m-%y_%H-%M).sql What is the way to backup it as tar.

Postgresql Multiple counts for one table

From two columns in my table I want to get a unified count for the values in these columns. As an example, two columns are: Table: reports | type

Copy a table from one database to another in Postgres

I am trying to copy an entire table from one database to another in Postgres. Any suggestions?

psql: command not found Mac

I installed PostgreSQL via the graphical install on http://www.postgresql.org/download/macosx/ I see it in my applications and also have the psql terminal in m

Postgres split timestamp column to time column and date column

Hi as the title says I have a column named healthtime in my table which is of type timestamp without timezone i.e. Healthime 2012-02-02 08:15:00 I would like

AWS RDS Postgres: WAL_LEVEL not set to 'logical' after changing rds.logical_replication = 1

I am in the process of setting up Debezium to work with AWS Aurora Postgres (postgres version 12.6). For Debezium to work, the WAL (Write-ahead-logging) must be

postgres LISTEN/NOTIFY rails

Ryan Bates mentions the LISTEN/NOTIFY functionality of Postgres when discussing push notifications in this episode, but I haven't been able to find any hint on