"NikhilS" <[EMAIL PROTECTED]> writes: > Coincidently, I very briefly discussed (offline) about supporting > expressions while doing loads using COPY FROM with Heikki a while back. From > the above mail exchanges, it does appear that adding this kind of > functionality will be useful while doing bulk imports into tables using > COPY. > > Heikki's initial suggestion was as follows: > > COPY <table> FROM <file> USING <query> > > Where query could be any SELECT query, executed once for row using the > values from the input data file. For example:
Another direction to head would be to take away COPY's special logic to insert into tables and instead have something like: COPY FROM <file> USING <query> where <query> is an *INSERT* statement. Or for that matter a DELETE or an UPDATE. It would prepare the query then execute it once per line read from the streamed copy data. It would be much more general but perhaps be harder to optimize the our current COPY can be optimized. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's PostGIS support! ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate