Error with Insert from View with ON Conflict - Mailing list pgsql-general

From Alex Magnum
Subject Error with Insert from View with ON Conflict
Date
Msg-id CA+cR4zdhrg0-mmBNw5e6POhTYFD3EijEauUyq9wuhqcFOsPYPg@mail.gmail.com
Whole thread Raw
Responses Re: Error with Insert from View with ON Conflict  (Steve Baldwin <steve.baldwin@gmail.com>)
List pgsql-general
Hi,
I am trying to do an upsert using a view but for some reason get errors. All works fine without the ON CONFLICT

INSERT INTO http_stats
SELECT * FROM view_http_stats AS V WHERE month =date_trunc('month',now())
ON CONFLICT (url,ip,month) DO UPDATE 
      SET last_update = now(),
          checks = V.checks,
          uptime = V.uptime,
          errors = V.errors;

ERROR:  42P01: missing FROM-clause entry for table "v"
LINE 5:           checks = V.checks,
                           ^
LOCATION:  errorMissingRTE, parse_relation.c:3460

Any help would be appreciated. Thanks in advance.

A

pgsql-general by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Re: to_date() and to_timestamp() with negative years
Next
From: Steve Baldwin
Date:
Subject: Re: Error with Insert from View with ON Conflict