connection strings not working in 6.x
See original GitHub issueMoving from v5.1 to v6.x, the same connection strings no longer work.
This used to work up until v5.1 at least:
var cn = "postgres://postgres@localhost:5433/newone";
pg.connect(cn,...)
Now with v6.1, calling:
var cn = "postgres://postgres@localhost:5433/newone";
var pool = new pg.Pool(cn);
pool.connect(function (err, client, done) {
throws the following error:
{ error: database "Vitaly" does not exist
at Connection.parseE (D:\NodeJS\tests\node_modules\pg\lib\connection.js:543:11) at Connection.parseMessage (D:\NodeJS\tests\node_modules\pg\lib\connection.js:370:17)
at Socket.<anonymous> (D:\NodeJS\tests\node_modules\pg\lib\connection.js:109:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10) at TCP.onread (net.js:543:20)
name: 'error', length: 107,
severity: 'FATAL',
code: '3D000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'src\\backend\\utils\\init\\postinit.c',
line: '775',
routine: 'InitPostgres' }
I had to explicitly switch to the config object to make it work:
var cn = {
database: 'newone',
port: 5433,
host: 'localhost',
user: 'postgres'
};
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:29 (9 by maintainers)
Top Results From Across the Web
Connection String not working - MSDN
I have a data layer that contains table adapters and they use another connection string that is stored in 'app.config', so i changed...
Read more >Config connection string in .net core 6
NET 6, I recognize that Startup and Program classes are merged into one class. And the above code is not usable in .NET...
Read more >SQL Server connection strings - ConnectionStrings.com
Connection strings for SQL Server. Connect using Microsoft.Data.SqlClient, SqlConnection, MSOLEDBSQL, SQLNCLI11 OLEDB, SQLNCLI10 OLEDB, SQLNCLI OLEDB.
Read more >Why Does My ConfigurationManager Connection String Not ...
If you are having trouble getting a connection string to read from your configuration file, check this out.Common Error: Object reference ...
Read more >Connection String URI Format
If the connection string does not specify a database/ you must specify a slash ( / ) between the last host and the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
But why database Vitaly does not exist?
Since
pg-pool
expects a config object and pool-factory.js was simply passing the argument directly topg-pool
it seems like checking if the passed in options are a string and parsing them into an object is all that was needed. I’ve created a PR but it seems the Travis build is having issues (I have the same issues running locally off master).