Re: Insert works but fails for merge

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: yudhi s <learnerdatabase99(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Insert works but fails for merge
Date: 2024-08-09 21:24:46
Message-ID: CAKFQuwY3itH6rZ8xxjyZOgm6wbNCB2Rt+z24vpb4dZYD_9YypQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Aug 9, 2024 at 2:14 PM yudhi s <learnerdatabase99(at)gmail(dot)com> wrote:

>
> Why so?
>

Because you stuck a CTE in between the column list of the insert - where
types are known - and the values command - where types are unknown since
you didn't specify them. As the row comes out of the CTE every column must
have a known type, and so in the absence of context they get typed as text.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-08-09 21:26:50 Re: Insert works but fails for merge
Previous Message yudhi s 2024-08-09 21:13:28 Insert works but fails for merge