Re: how to do merge in postgres ("with upsert as" not supported)

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: how to do merge in postgres ("with upsert as" not supported)
Дата
Msg-id mcpbaj$clo$1@ger.gmane.org
обсуждение исходный текст
Ответ на how to do merge in postgres ("with upsert as" not supported)  (Tong Michael <michaelbleedgreen@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: Re: [pgadmin-support] Issue with a hanging apply process on the replica db after vacuum works on primary
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Regarding "Point-in-time Recovery" feature