_TIMESTAMP
WHERE pid = (SELECT pid FROM s UNION SELECT pid FROM i) Or pid = (SELECT
pid FROM s Where area = '11')
RETURNING pid;
insert does not returning pid
On Thu, May 16, 2019 at 9:51 PM Adrian Klaver
wrote:
> On 5/16/19 7:25 AM, Winanjaya Amijoyo wrote:
> > see enclosed screensho
t 9:47 PM Adrian Klaver
wrote:
> On 5/16/19 7:26 AM, Winanjaya Amijoyo wrote:
> > and yes .. I need both inserted pid and updated pid
>
> The INSERT pid is going to be 'swallowed' by the CTE that is why the:
>
> SELECT pid FROM s UNION SELECT pid FROM i
>
and yes .. I need both inserted pid and updated pid
On Thu, May 16, 2019 at 9:25 PM Winanjaya Amijoyo <
winanjaya.amij...@gmail.com> wrote:
> see enclosed screenshot..
>
> I thought, the record still locked that's why it returns empty..
>
> On Thu, May 16, 2019 at 9:21
see enclosed screenshot..
I thought, the record still locked that's why it returns empty..
On Thu, May 16, 2019 at 9:21 PM Adrian Klaver
wrote:
> On 5/16/19 7:10 AM, Winanjaya Amijoyo wrote:
> > Hi David,
> >
> > thanks for your advise, as I am new with postgresql.
u, 16 May 2019 at 21:13, Winanjaya Amijoyo
> wrote:
> > When record not found then insert and return pid value or if not found
> then update based on pid and again return its pid.
>
> You could do something like:
>
> WITH s AS (
>SELECT pid FROM test WHERE area
Hi All,
I have records as below that I inserted using exclusion gist constraint
user_idstart_date end_date pid
001 2019-01-012019-02-101
001 2019-02-012019-03-122
001 2019-03-052019-06-153
I need to find records base
:28, Winanjaya Amijoyo
> wrote:
> > column pid is bigserial that I expect to return on both insert and update
> > I don't want to use ON CONFLICT since it would increasing the sequence
> although it updating the data
>
> It's not very clear what you're trying to do
column pid is bigserial that I expect to return on both insert and update
I don't want to use ON CONFLICT since it would increasing the sequence
although it updating the data
On Thu, May 16, 2019 at 3:26 PM David Rowley
wrote:
> On Thu, 16 May 2019 at 19:56, Winanjaya Amijoyo
> wrot
Hi all,
when running query below, pid returns empty when inserting new record
WITH s AS (
SELECT pid FROM test WHERE area = 'test5'
), i AS (
INSERT INTO test (area)
SELECT 'test5'
WHERE NOT EXISTS (SELECT 1 FROM s)
RETURNING pid
)
UPDATE area
SET last_update = CURRENT_TIMESTAMP
WH