All Questions
Tagged with node.js postgresql
6,023 questions
0
votes
0
answers
18
views
Using pgBouncer on DigitalOcean with Node.js pg Pool and Kysely – Can They Coexist?
I'm running a Node.js application that connects to my PostgreSQL database using Kysely and the pg Pool. Here's the snippet of my current DB connection logic.
I have deployed my database on ...
0
votes
0
answers
17
views
Re-Using schema across two projects in NODEJS SAPUI5 CAP FIORI
I am new to nodejs sapui5 fiori cap applications and I am trying to create two applications that use the same database schema, they are connected to the same database as it is part of a multi-step ...
-3
votes
0
answers
40
views
Openapi spec generator from database schema [closed]
Any thougts about a generator of Openapi spec (json, yaml) from database schema.
I would like to scaffold an nodejs rest api from Postgresql database schema , using fastify or other node framework. ...
0
votes
0
answers
27
views
How to add join query to a services where all model is initialized in seperate services and a particular service needs a model [closed]
Here is the customerservices retrieving all the carts item and the result look like this
{
"status": 200,
"msg": "success",
"result": [
{
...
1
vote
2
answers
62
views
Produce parentheses-enclosed list of values with pgpromise
I am using a queryfile to produce a query:
SELECT
lst.${layerTitleColumn:name}
FROM
(VALUES(${ids:list})) AS ids(id)
LEFT JOIN
${tableName:name} AS lst
ON
ids.id = lst.${layerIdColumn:name}
...
2
votes
0
answers
72
views
How can I efficiently process large PostgreSQL datasets in Node.js without high memory overhead?
I have a Node.js application that interacts with a PostgreSQL database containing millions of users. For a specific feature, I need to fetch around 100,000 users based on a criterion (for example, ...
0
votes
0
answers
43
views
Unable to connect to Cloud SQL PostgreSQL from Cloud Run using Unix Domain Socket
Environment
Google Cloud Run
Cloud SQL PostgreSQL instance
Node.js 18
TypeORM
Cloud SQL Auth Proxy (running in same container)
Current Setup
My Cloud Run service is configured with:
VPC Connector: ...
0
votes
0
answers
20
views
How to use pg Pool in node js nest js with typeorm
I already have a Node.js application using NestJS with TypeORM configured. Now, I want to implement a PostgreSQL connection pool using pg Pool for better database connection handling. Is it possible ...
0
votes
3
answers
69
views
getting NaN value some times and some times not
I get NaN value when I try to show the value of (item.total_amount,item.price,item.addtional_price) in ejs page but when I debug the variables some time I get the value and some time not!!
this is the ...
0
votes
2
answers
59
views
SequelizeModule — autoLoadModels / [Nest] ERROR SequelizeModule Unable to connect to the database. Retrying
I'm learning Nest.js, I'm trying to connect via SequelizeModule to my local postgres database, but I keep getting this error
Error when starting start:dev
[20:41:14] Starting compilation in watch mode....
1
vote
0
answers
35
views
How to dynamically change data in a table while selecting in TypeORM & PostgreSQL?
In my project, I'm trying to save actions that made by users for audit purpose, ex: creating new items, delete smth etc. I'm using postgresql and typeorm. let's say I have history table to save this. ...
1
vote
2
answers
72
views
Why does my pool.query return "undefined"?
The first query returns rows:
(async () => {
const {rows} = await pool.query('SELECT * FROM accounts');
console.log(rows);
})();
This query returns "undefined":
(async () => {
...
0
votes
0
answers
50
views
Supabase cannot connect to PostgreSQL database
I am facing this issue.
schema.prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
...
0
votes
0
answers
25
views
Issues with many to many relation with sequelize in my controller
This is my first time here, and I hope I can provide you with all the information you need.
I am using Sequelize for a project I am working on after completing my web development training. I have many ...
0
votes
1
answer
60
views
SequelizeConnectionRefusedError: Unable to connect to PostgreSQL Database in Node.js
I'm working on a Node.js backend using Express and Sequelize to connect to a PostgreSQL database. However, when I run node index.js, I get a SequelizeConnectionRefusedError.
My index.js file:
import ...
0
votes
2
answers
45
views
How can I show all rows that are null or not null?
I have a users ill table.
id | user_id | health_at (null or timestmap)
I have a preapred statement variable $1. it can be NULL or NOT NULL.
if is NULL I want to show all rows where HEALTH_AT IS NULL. ...
0
votes
0
answers
20
views
How to partially save an entity's properties to different database?
Background
I'm implementing an API endpoint for creating a user with MikroORM. Requirement tells me that I need the user info saved on a PostgreSQL server—except for user password; I need the ...
0
votes
0
answers
72
views
Connecting postgresql with langchain in nodejs isn't working properly. Although, there aren't any errors
so I tried doing this but I am not getting the data as expected from the database. Although, I got it at some times but I don't know what's going on here. here is the code :
INDEX.JS
// index.js
const ...
0
votes
1
answer
26
views
Starting application development using Docker or configuring Docker during development? [closed]
I'm starting to build an application where I'm going to use Docker for the first time, but I have a question:
Should I already start the application and the database using Docker or do I configure ...
0
votes
1
answer
86
views
NGINX not returning response as application/json in my production app, but same code works in dev (express) and stage (Cowboy) env
I have a website that I developing using express as backend and Angular as frontend.
I created an API to access a PostgreSQL db (using node-postgres) which seems to work fine locally and in my stage ...
0
votes
1
answer
120
views
Can't build Docker image with Postgresql
I'm trying to build the Docker image for deploying to a VPS (pulling it from DockerHub), but it gives me an error all the time, I thin related to the connection of the Database instance. I tried to ...
1
vote
0
answers
61
views
Fire a query to DB and close the connection immediately
I have a request that takes a long time to execute, and I don't need to wait for its response.
Therefore, I need the server to close connection to DB immediately after firing the query, and for it to ...
0
votes
2
answers
32
views
How to filter associated models connected using through table and keeping all associated model
I want to filter conversations based on a user Id and get all users in that conversation. Users and conversations are joined using a through model
This is my approach
user.entity.ts
@BelongsToMany(...
0
votes
1
answer
22
views
How do you safely insert a variable into an array with postgresql and nodejs?
I can unsafely modify an array like this:
await pool.query(`UPDATE profiles SET friends = friends || '{"${newFriend}"}'`);
however this leaves you open to SQL injection etc. It is ideal to ...
0
votes
1
answer
32
views
nodejs / postgres connect issue
I am new on nodejs and postgres and I have this code
import { Client } from "node-postgres";
(async () => {
const client = new Client({
user: 'testuser',
host: '127.0....
0
votes
0
answers
19
views
typeorm trying to delete relation table data when there is no change
I have project entity which has systemInstances. And systemInstance have a manytomany child and parent relation. When I try to update Project entity with same systemInstances, typeorm giving this ...
0
votes
0
answers
28
views
Node JS Postgresql connection error / error: no pg_hba.conf entry
(I'm korean. My English can be terrible.)
I want my node app to connect AWS RDS.
but the error occured.
how can I sovle this?
Error Message
enter image description here
My Code
config/db.js
require(&...
0
votes
0
answers
23
views
cHow to fetch distinct members with their respective assessments in a paginated format using TypeORM and subqueries?
The problem is related to fetching distinct members along with their respective assessment details in a paginated format using TypeORM and subqueries. The goal is to return assessments grouped by ...
0
votes
1
answer
55
views
UNION ALL is extremely slow in postgres
I am new to postgres and am having trouble speeding this tsvector query up. I already have indexes on all the tables but the query is taking absurdly long. Any help is greatly appreciated as I assume ...
0
votes
0
answers
50
views
Issue with Node-PG-Migrate and Incorrect Database Name
I'm using node-pg-migrate for my migrations, and I've set up my .env file with a custom database name, but when I run the migration command, it always tries to connect to a database with my PC's admin ...
0
votes
1
answer
65
views
Easy to answer "More expressions than columns" when using CURRENT_TIMESTAMP
My typescript code is trying to insert a record into an RDS cluster and it's giving me |
ERROR Error saving mytable record: error:
error: INSERT has more expressions than target columns
I believe I ...
0
votes
0
answers
64
views
How you handle multiple connection strings in postgres?
When you have a SaaS app and you have different connection strings, how you handle the connection for each tenant ? And you create every time a new connection or ? So how you can handle this ...
0
votes
1
answer
23
views
Can sequelize have self ref column to support a child parent relationship within the same table?
does seauelize support self reference tables?
For example, if I have a table called product, and logically, it has child / parent relationships with its self, so I defined a parent_id column that has ...
0
votes
1
answer
64
views
How you handle performance at pagination when you have to count all rows?
I learned page based pagination and cursor pagination. With both, I need the total count to show more results or not. The problem is I count all rows for each new page, it's bad for performance. Is ...
1
vote
1
answer
375
views
Pg - Next js 15 Module not found: Can't resolve 'fs'
I am using next js 15 and drizzle orm. I have just added drizzle and setup the boilerplate and when i run it i get this error.
Error:
GET /_next/static/webpack/f2b54d6051787b9b.webpack.hot-update.json ...
0
votes
0
answers
43
views
Failed to connect to the database error: invalid page in block 22 of relation base/12971/2674
I am trying to run in-memory Postgres using pgmock, the connection is getting established but getting this error while running any query.
Failed to connect to the database error: invalid page in ...
0
votes
1
answer
34
views
How to pass data to multiple database tables in NodeJS using google OAuth?
passport.use("google",
new GoogleStrategy(
{
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: "http://...
1
vote
0
answers
32
views
Sequelize associations with multi-tenant (schemas) solution
I'm rather new to backend development, so bear with me.
I have a 'partners' table in the 'public' schema and each partner has their own schema like 'partner_1', 'partner_2', etc...
Their schemas ...
1
vote
1
answer
37
views
I want to store more than one data in a column in my PostgreSQL Database [closed]
I am designing a database for a blog content. For example, let's say I need data for a ‘bibliography’ column to be included in my blog content. A blog content can have more than one bibliography ...
1
vote
0
answers
22
views
How to run nightwatch on Github actions with containerized postgres?
I have nightwatch working locally, but I want to run it in Github actions as well. I connect to postgres in my test using Docker. Running the Github action gives me this error:
Run xvfb-run --auto-...
1
vote
0
answers
20
views
SequelizeAssociationError: Conflict in defining HasMany and BelongsTo relationships between User and Friends models
I am trying to define a HasMany and BelongsTo relationship between my User and Friends models in Sequelize. However, I am encountering the following error when I start my server:
AssociationError [...
0
votes
1
answer
650
views
prisma generate problem ( The "path" argument must be of type string. Received undefined )
hello guys i recently workings on a nextjs project ( turborepo - monorepo )
and after few minutes i realized that i have to add new column in my table
so i just updated my schema.prisma by adding a ...
-1
votes
1
answer
59
views
Getting ERR_MODULE_NOT_FOUND in my Heroku App but working fine in localhost
Thanks for being here.
My stack
Postgres
Node 20.17.0
Express
Sequelize ORM
Javascript
When started happening?
This started happening after migrating my app from the 'require' to 'import' syntax. I ...
0
votes
0
answers
30
views
Issue in loop update of rows of DB
I was setting up foreign key of one table by using some data from other table. I am trying to do this by using for loop in node-js and the db is in postgres. There is too much data and I am not sure ...
0
votes
0
answers
28
views
pgsql typeorm query is not working as expected in nestjs nodejs
I have this query to get the records based on some conditions
async getChangePayments(filter: DataFilterDto): Promise<ApiResponseDto> {
const take = filter.count || 10;
const pageNo = ...
0
votes
0
answers
98
views
Connect to Digital Ocean Managed Database (Postgres) With NodeJS app
I have spent three days trying to connect to my DO Managed Database (Postgres version 16). My server is Ubuntu 22.04, and the NodeJS version is 20.18.0. I was connected to the database up until June ...
0
votes
0
answers
100
views
password authentication failure while connecting to Neon postgres db
I am working on a Nodejs/Express application, and I am trying to connect to a newly created Neon postgres database with knex ORM. My knexfile.js file is below. I have taken the values of all the env ...
0
votes
0
answers
43
views
consistency of "OFFSET" in PostgreSQL query
I am trying to make a script which changes a lot of db entries (>100Mio entries)
since this is so much, I need to work in some kind of batches. Now to find the correct batch I do something like ...
1
vote
1
answer
71
views
Why can't I filter posts in my postgreSQL database by author? (Issue Resolved)
So I have a service where I let users post book reviews. I myself have posted two. In my database I keep track of the user names that they input when submiting a post.
for some weird reason, it will ...
-2
votes
1
answer
36
views
Postgresql database does not interaction with my simple Node.js server
Links with server and postgresql database. There are three elements in the register: full name, email, and password, but the information in the register does not seem to be linked to the database. ...