Tag Archives: PostgreSQL Error

[Solved] PostgreSQL Error: Could not connect to server: no such file or directory

1. Problem description

when operating PostgreSQL database service, an error message is received: 

Could not connect to server: no such file or directory

2. Solution

PostgreSQL error message “could not connect to server: no such file or directory” it is known that it is caused by the problem of postmaster

the error message indicates that PostgreSQL is not running in the system where the user logs in. When handling this common error, check “postmaster.PID” in the data directory. Ensure that the configuration of PostgreSQL allows TCP/IP connections

[Solved] PostgreSQL Error: ERROR: CURRENT TRANSACTION IS ABORTED, COMMANDS IGNORED UNTIL END OF TRANSA

Error occurred:

Current transaction is aborted, commands ignored until end of transaction block

analysis:

The transaction contains errors. When the DML is executed again, the transaction cannot proceed normally.

When automatic transaction submission is turned off in PG database, we often encounter such problems
error:   Current transaction is aborted, commands ignored until end of transaction block
the reason why this problem is caused is that
in the Postgres database, if an error occurs in a database operation in the same transaction, the database after the transaction will make an error
let’s take a very simple example
test = # select * from test1
ERROR:   relation “test1” does not exist
LINE 1: select * from test1;
^
time: 0.376 MS
at this time, because there is no operation error, all subsequent operations in this session will report
error:   Current transaction is aborted, commands ignored until end of transaction block
to solve this problem, we can only use rollback or commit
PG is not user-friendly
Solution:

1. Try connection.setautocommit (true); Cannot execute

2. Commit directly, execute the insert statement after submitting, and insert successfully.

Refer to the stackoverflow solution:

postgresql – PSQLException: current transaction is aborted, commands ignored until end of transaction block – Stack Overflow