Search Postgresql Archives

UPDATE syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Need some help with UPDATE syntax. I am attempting to do something like this:

 

WITH default_facility AS (

                SELECT facility_id,

                inkjetorlabel

                FROM engagement_facility_defs

                WHERE engagement_facility_def_id = 8

)

UPDATE engagement_facilities SET (

                facility_id,

                inkjetorlabel

)

= ( default_facility.* )

FROM default_facility

WHERE engagement_facilities.engagement_id =3

 

 

 

Postgres errors out on the SET() saying “number of columns does not match number of values”.  Also tried default_facility.* without the parenthesis but it does not like that syntax. This example is a bit simplified, in reality there are 90 columns in both lists.

 

Is this syntax not possible? I have rewritten it to this form which works, but I rather like the CTE syntax instead.

 

UPDATE engagement_facilities SET (

                facility_id,

                inkjetorlabel

)

= ( df.facility_id, df.inkjetorlabel )

FROM   engagement_facility_defs df

WHERE engagement_facility_def_id = 8

AND engagement_facilities.engagement_id =3

 

 

 

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux