根据条件和无条件将相同 table 的值填充到 table

populating values to a table from the same table based on condition and without condition

我有一个名为 'plot' 的 table,其中包含 'id'、'tablename'、'geom'、'description' 等列。我需要根据特定的 condition.For ex select geom, description from plot where id=2; 但是,我需要从相同的 table 本身填充 geom 和 plot 的描述 table需要用 postgresql 中可能的不同 values.Is 填充其他拖列 'id' 和 'tablename'?

当然可以,比如

INSERT INTO plot (id, tablename, geom, description)
   SELECT 42, 'mytablename', p.geom, p.description
   FROM plot p
   WHERE id = 2;