Re: copy record?
| От | Bosco Rama |
|---|---|
| Тема | Re: copy record? |
| Дата | |
| Msg-id | 4DDEC3B1.2050008@boscorama.com обсуждение исходный текст |
| Ответ на | Re: copy record? ("Gauthier, Dave" <dave.gauthier@intel.com>) |
| Список | pgsql-general |
Gauthier, Dave wrote: > Well, I found a better way, but still open to suggestions. > > This is what I have so far... > > create temporary table foo as select * from maintable where 1-0; -- Credit 4 this goes to a post in the PG archives > insert into foo (select * from maintable where primcol=123); > update foo, set primcol=456; > insert into maintable (select * from foo); This alleviates the need to trick the back-end using 'where 1-0' and also does the insert, all in one go. select * into temp table foo from maintable where primcol=123; update foo set primcol = 456; insert into maintable select * from foo; You also may need this is if you intend to use the same sequence of calls on within the same session: drop table foo; HTH Bosco.
В списке pgsql-general по дате отправления: