Questions tagged [psql]
Primary interactive shell for PostgreSQL. NOT a synonym for PostgreSQL.
psql
3,737
questions
0
votes
0
answers
51
views
psql prompt for creating database doesn't work
in psql i'm trying to create a database, but nothing really happens seems like psql is expecting me to continue with the prompt.
postgres=# CREATE DATABASE testdb1;
;
;
\q
^CCancel request sent
ERROR:...
0
votes
1
answer
46
views
Why does the SELECT OFFSET take the same time as the SELECT without OFFSET?
id is the primary key.
EXPLAIN SELECT id FROM data
LIMIT 1000000
Limit (cost=0.44..18840.00 rows=1000000 width=8)
EXPLAIN SELECT id FROM data
LIMIT 1000000 OFFSET 1000000
Limit (cost=18840.00.....
1
vote
1
answer
30
views
Problem with PSQL encoding of french in Windows cmd prompt
I've been struggling with PSQL and encoding in Windows cmd prompt for a while now and although I managed to make it work about 4 times with 4 different databases, it seems that every time the problem ...
-1
votes
0
answers
44
views
Best practise to manage PSQL Client in Go? [closed]
I'm working on integrating PostgreSQL into my Go project and have a few questions about structuring the psqlClient:
Initialization Strategy: Should I initialize the psqlClient at the start of the ...
0
votes
0
answers
34
views
Permission denied for \copy using psql
Making a batch using windows, psql. I have this \copy statement
@echo off
SETLOCAL
REM Set variables
SET "DB_HOST=localhost"
SET "DB_PORT=5432"
SET "DB_NAME=postgres"
...
0
votes
1
answer
24
views
Extending IntIdTable in Kotlin Exposed PSQL does not inherit primary key
Problem Summary
I'm trying to create an abstract class UserTable that inherits the IntIdTable of the Kotlin Exposed framework as such:
abstract class UserTable : IntIdTable() {
val userId = ...
1
vote
1
answer
51
views
PostgreSQL: Query with ORDER BY, LIMIT, and OFFSET consistently returns the same record at the end of the result set regardless of OFFSET value
Our team has sat on this for a while and struggling to understand what is going.
When ordering by created_at and all the created_ats are the same for the records we see the same record appearing as ...
0
votes
0
answers
16
views
Slowness in function call in PostgreSQL
I have written a function in postgreSQL which returns integer.
The function was taking only .05 seconds to execute in the DB.
The DB was then backed up, restored and upgraded to PG 15 from PG 10.
All ...
0
votes
1
answer
20
views
Copying tab-delimited file in Postgress with empty files
I'm trying to import a tab-delimited file using the PSql COPY command
copy TABLE(col1, col2, etc)
from /file.txt';
The problem is that some of my columns are empty. This includes the last column....
-1
votes
0
answers
30
views
\copy function "schema does not exist"
I have this code
psql -U postgres -p 5432 -h localhost -d postgres -c "\copy Dibbs.dibbs_db (customer_name, Quote_number, Polytronix_Part_number, Order_Status, Bid_Total, Unit_Price, ...
0
votes
0
answers
25
views
How to create a trigger to update columnA using columnB value after insert in postgresDB?
I am loading data to postgresDB from a csv file using psql in shell and want to create trigger which updates columnA using columnB value.
Postgres DB -
TableA - (columnA, columnB, stripped_columnA, ...
0
votes
0
answers
27
views
Dynamic csv import using batch
I need to import daily csv files with the name "DailySummary%todaysdate%" into my postgres table. I tried using a dynamic copy function which I can't seem to figure out.
Would it be better ...
0
votes
0
answers
24
views
Making batch file to run .sql files and dynamic import
Couple of problems.
Need to run a .sql file from batch. (do they run the queries from top to bottom kinda thing?) Having some problems connecting to psql, database, and schema.
In one of the querys I ...
0
votes
1
answer
28
views
Changing primary replication config in standby node
I want to change the primary information to new primary node in standby postgresql node. I have this:
# In standby server
psql -At -U $POSTGRES_USER -d $POSTGRES_DB -p $PGPORT -c "ALTER SYSTEM ...
0
votes
1
answer
34
views
Cannot create relation(table) in my postgresql database
I'm trying to create a Spring Boot API and connect it to a simple Postgresql database that I have created . I am connecting to a local server. I'm trying to set up the connection so that my table is ...