All Questions
53 questions
1
vote
0
answers
44
views
how to delete a user in an array with postgres sql command
I have an array that is very complicated, at least for me, to manipulate. I created a json array, but since it is formatted, it is difficult for me to delete a user from the array that is the array of ...
1
vote
1
answer
2k
views
How to display a nested array in Next.js or to change it to object
{
"count": 2,
"rows": [
{
"id": "5ab46e31-391c-46a7-8e45-db9ada07626d",
"name": "admin",
...
0
votes
1
answer
168
views
How can I efficiently pass JSON data from a PostgreSQL jsonb field to Javascript?
I am looking for a smart solution to process some JSON data from a postgresql database in Javascript. I understand that I need to read the database via php and pass the data as an array to Javascript.
...
1
vote
1
answer
1k
views
Prisma find element on one to many relation where array of ids are assign to element
I have prisma schema
model StoryHashtag {
id Int @id @default(autoincrement())
title String
stories Story[]
}
model Story {
id String @id @default(uuid())
...
0
votes
1
answer
32
views
How to compare if a substring exist inside an array in PostgreSQL query?
example
const testString = "bmw,honda,mercedes,audi"
const testArray = ['renault', 'mini', 'honda', 'dacia']
how to check if at least on element from testString exist on testArray
tried ...
-1
votes
1
answer
45
views
Pgsql UPDATE in a web system with multiple entities
I want to update ta.nmbr and ta.totl to an existing indctr. How do I do it? is it possible to join?
This is the SELECT query.
$sql = "SELECT ind.indctr_code, ind.indctr_name, ctr_ind....
0
votes
0
answers
54
views
How to read an array of data [duplicate]
I'm making a query where I'm collecting data froma data table.. Here is what I get :
I want to push each value of the array in another array but here is what I get when I console.log() it :
Here is ...
0
votes
2
answers
3k
views
Error: Malformed array literal, trying to pass in an array into TEXT[] column
So I have an array that has been created in Node.JS by pushing elements to an array, that I'm then trying to set to a PostgreSQL Text[] column. So it's something like this:
var hours = []
for (x of ...
0
votes
4
answers
1k
views
SQL to only return table values found in array values
SQL noob trying to return db results if a table value is found in an array. I'm using Node JS and Postgres.
So far, I can figure out how to return the result for a single item:
SELECT * FROM table ...
-1
votes
1
answer
466
views
SQL insert array of string - issues with .join(', ')
Currently I create a string with JavaScript that is used as a SQL query. It reads a number of rows from an Excel sheet and then creates the SQL query by combining all those datapoints with .join(','). ...
0
votes
2
answers
660
views
How can I map a JavaScript array to save every element to a database and return the saved item?
I am working on an application that allows users to send an email to a list of contacts. Here is how the function that I am having trouble with works:
The email content is saved to the database.
The ...
2
votes
0
answers
378
views
How to add multiple values in one query to a PostgreSQL array?
So if I have a Javascript array of strings, how do I append each element to a row in the Postgres text[] column? This is what I'm currently using, but it's not yielding the desired result (which is ...
-1
votes
1
answer
53
views
What to do next to display data onto HTML using JS after acquiring data from database?
I am doing an exercise to create a small website that display data to HTML from PostgreSQL using TypeScript or Javascript. After I retrieved the data, I don't know what to do next to display the data ...
1
vote
1
answer
689
views
PostgreSQL - WHERE id IN(array) returns error: invalid input syntax for type integer:
I am using a pg in with nodejs. I have a simple query:
const processedAlerts = [
180, 186, 192, 198,
204, 210, 216, 222,
228, 234, 240, 246,
258]
response = await pool.query(`UPDATE alert_notification ...
0
votes
1
answer
327
views
I want to insert an array of type array into postgress but I don't know how to do it from node
query.callfunction('fn_create_mp_product', parameters, (err, result) => {
if (err) {
console.log(err)
callback(err);
} else {
if (result.status ==...