Search Postgresql Archives

Re: Duplicating rows in one table but with one column value

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

 



Anastasios Hatzis wrote:

rows = plpy.execute("""SELECT "FooHolding" WHERE "CoosOfFoo_vid" = ORIGINALVALUE;""")
for row in rows:
   for col in row:
plpy.execute("""INSERT INTO "FooHolding" ("CoosOfFoo_eid", "CoosOfFoo_vid", "FoosOfCoo_eid", "FoosOfCoo_vid") VALUES (col[0], COPYVALUE, col[2], col[3]);""")

Well, I want to fix my given code example, although I guess, the idea is obvious ;-)

rows = plpy.execute("""SELECT * FROM "FooHolding" WHERE "CoosOfFoo_vid" = ORIGINALVALUE;""")
for row in rows:
plpy.execute("""INSERT INTO "FooHolding" ("CoosOfFoo_eid", "CoosOfFoo_vid", "FoosOfCoo_eid", "FoosOfCoo_vid") VALUES (row[0], COPYVALUE, row[2], row[3]);""")


Sorry,

Anastasios


[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