Re: how to do merge in postgres ("with upsert as" not supported) - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: how to do merge in postgres ("with upsert as" not supported)
Date
Msg-id mcpbaj$clo$1@ger.gmane.org
Whole thread Raw
In response to how to do merge in postgres ("with upsert as" not supported)  (Tong Michael <michaelbleedgreen@gmail.com>)
List pgsql-general
Tong Michael schrieb am 26.02.2015 um 21:23:
>
> hey, guys, I came across a merge statement when I'm trying to convert stored procedures from Mysql to Postgres:____
>
> __ __
>
> merge into db.ChargePeriod d____
> using (____
>     select ba.ClientID____
> ...
> ...

That can't be MySQL - MySQL does not have a MERGE statement.
That looks much more like SQL Server's T-SQL (MERGE, @ style variables, convert() function...)

Here are several ways to do it: http://stackoverflow.com/q/1109061/330315

> I saw some people use "with upsert as", but my pgAdmin version(1.8) doesn't support it.

pgAdmin supports whatever your Postgres version supports.
All supported/maintained Postgres versions support common table expressions.

What exactly do you mean with "doesn't support it"? What was the exact SQL statement you tried?



pgsql-general by date:

Previous
From: Jim Nasby
Date:
Subject: Re: Re: [pgadmin-support] Issue with a hanging apply process on the replica db after vacuum works on primary
Next
From: Jim Nasby
Date:
Subject: Re: Regarding "Point-in-time Recovery" feature