Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why pg_dump/psql throws "FATAL: no PostgreSQL user name specified in startup packet"?

I am trying to run pg_dump (or even psql) over our postgresql server v13, with binaries from v13 and v16. Both don't work for me, but do work for my colleagues that are not on Mac, not sure if it's related to that.

When I try to run:

pg_dump -U grails --verbose --host=<host> --port=<port> --format=plain <db_name> > <target_file>

or even simple:

psql -U grails --host=.. --port=..

I get the following:

pg_dump: error: connection to server at "...", port ... failed: FATAL:  no PostgreSQL user name specified in startup packet
connection to server at "...", port ... failed: FATAL:  no PostgreSQL user name specified in startup packet
pg_dump(71055,0x1db08dec0) malloc: *** error for object 0x92: pointer being freed was not allocated
pg_dump(71055,0x1db08dec0) malloc: *** set a breakpoint in malloc_error_break to debug
[1]    71055 abort      pg_dump --verbose --host=... --port=... -U grails --format=plain  

The user name is clearly specified as parameter and my colleagues have no problem. The malloc errors are weird too. What might be happening?

like image 779
Ev0oD Avatar asked Sep 03 '25 03:09

Ev0oD


2 Answers

This issue (which I also faced) seems to be caused by an incompatibility/bug between Postgres and openssl version 3.2.0.

Homebrew's Postgreses now are compatible with openssl 3.2, please run brew upgrade postgresql@<YOUR POSTGRES VERSION> or brew upgrade libpq to get the fixed version here for homebrew users

(before Nov 28, 2023: Downgrading to openssl version 3.1.4 (as documented here for homebrew users) worked for me as a workaround.)

like image 51
David Runger Avatar answered Sep 05 '25 00:09

David Runger


Seems like the problem is with the brew version of Postgres. I tried installing Postgres with their installer from the official website and I am not running into the issues that I have when using binaries I fetched from homebrew.

like image 40
Ev0oD Avatar answered Sep 04 '25 23:09

Ev0oD