All Questions
Tagged with insert-update postgresql
74
questions
-1
votes
0
answers
14
views
Updating Postgres Table using a Datastream in spark
I am using scala Api "2.12.15" of spark "3.5.0" and i am trying to use a data stream to update the rows of my Postgres table :
my data stream and my table both has the same columns
...
0
votes
2
answers
225
views
Insert Into On Conflict With a Where Clause
I have a SQL query that looks like this:
INSERT INTO testing.names
(
id,
first_name,
active_status
)
-------------------------------------
SELECT
stage.id,
stage.first_name,
...
1
vote
2
answers
333
views
Column reference in "On Conflict" is ambiguous
I created the following table:
CREATE TABLE IF NOT EXISTS public.publications (
publication_id bigint NOT NULL DEFAULT nextval('eap_publications_publication_id_seq'::regclass),
title character ...
0
votes
1
answer
81
views
postgresql jsonb update List of string value based on existing values searched in other table
I have two tables like these in postgres db :
TABLE tag (
id number,
name nvarchar
);
TABLE article (
id number,
tags jsonb // List<String> list of **name**s of tags from tag ...
1
vote
1
answer
424
views
Upsert records in postgresql
I am working with postgresql database and I have below update query which works fine -
'UPDATE "main"."item_vendor"\n' +
' SET\n' +
' "vendor_id" = $1,...
0
votes
0
answers
143
views
insertIgnore of Exposed is not inserting data
I have made this table:
object PartnerOwnerMappingTable : IntIdTable("partner_owner_mapping") {
val ownerId = integer("owner_id")
val driverUUID = uuid("driver_uuid")
...
0
votes
1
answer
1k
views
How to upsert record from one db connection to another in postgres using dbeaver?
I have two connections in my dbeaver namely preproduction and postproduction. Both the database have a table called profiles.
I want to upsert data from my postproduction.profiles into preproduction....
1
vote
1
answer
230
views
golang/pq : "pq: function uniq(integer[]) does not exist"
Here's my code (works fine with gin)
query :=`
UPDATE posts SET liked_by = uniq(array_append(liked_by, $1))
WHERE id = $2
RETURNING liked_by`
return p.DB.Exec(query, userID, post.ID)
The error I'm ...
-1
votes
1
answer
73
views
i can't add column from query to table as new column (postgresql)
I selected only digit from column and want to add this new column to my table with selected digits
SELECT
left(orgi.dt_new, strpos(dt, ' ') - 1) AS day_
FROM
(SELECT *,
CASE
WHEN ...
1
vote
1
answer
2k
views
How to not increment sequence when conflict of insert occurs
When a conflict occurs on insert into a table with an auto incrementing id column, the sequence gets bumped causing a gap in the id range, which for me is undesirable.
Here is a simplified version of ...
2
votes
2
answers
660
views
Concatenate string instead of just replacing it
I have a table with standard columns where I want to perform regular INSERTs.
But one of the columns is of type varchar with special semantics. It's a string that's supposed to behave as a set of ...
0
votes
1
answer
283
views
Reading txt file in real time and update postgressql database using Python
I have a txt file with many rows what is updating in real time.
e.g. :
001;2021/11/16;08:00:12;IN;123456789;123456;John Doe
001;2021/11/16;09:00:18;OUT;987654321;654321;Jane Doe
And I have a postgrest ...
0
votes
1
answer
1k
views
Postgres upsert with composite unique key to allow only single null value
As a part of ETL, table continuous_trips has continuous flow of incoming records.
New records are aggregated and get inserted into temp. table called trips_agg every 5 minutes.
CREATE TABLE IF NOT ...
0
votes
1
answer
608
views
What is returned by an INSERT ON DUPLICATE statement? [duplicate]
In Postgresql, when inserting rows with an on conflict and a returning clause, what is returned? The row that was inserted? The row before insertion? What if no row was inserted?
Consider the ...
0
votes
0
answers
144
views
Postgres Update on timestamptz constraint causing duplicates
I am running upsert on a table which has a constraint of id and created date. Created date type is timestamptz.
insert into target.events (event_id, event_type, created_at, updated_at)
select source....