-
Notifications
You must be signed in to change notification settings - Fork 24
Description
While running any cerate db queries I am getting the above error
sample code for reproduce the issue
const { Client } = require('pg');
const { PostgresMock } = require('pgmock');
const client = new Client({
user: "postgres",
host: "localhost",
database: "postgres",
password: "pgmock",
port: "5432",
});
async function connectToDatabase() {
try {
const mock = await PostgresMock.create();
const connectionString = await mock.listen(5432);
console.log("connectionString" + connectionString);
await client.connect();
console.debug("Connected to the postgres database named: " + "postgres");
await client.query(CREATE TABLE Persons ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) )
);
console.log("Table created successfully");
} catch (err) {
console.error("Failed to connect to the database", err);
throw err;
}}
connectToDatabase();