COPY and default values
От | Neil Conway |
---|---|
Тема | COPY and default values |
Дата | |
Msg-id | 20020527151312.695c88be.nconway@klamath.dyndns.org обсуждение исходный текст |
Ответы |
Re: COPY and default values
|
Список | pgsql-patches |
The attached patch changes COPY so that if no value for an attribute is specified, the default value for the attribute (or the attribute's type) will be assigned, rather than NULL. I'll write some regression tests and update the docs later. Also, there's a possible optimization that I didn't implement: if the default value Node is a 'Const', we can safely evaluate and store the default value once for the lifetime of the COPY, rather than every time that it is needed. However, Const Nodes are evaluated very quickly by ExecEvalExpr(), so I'm not sure if it's worth worrying about... There's one major problem with the patch, which I haven't been able to fix: when there are multiple rows of data which require default values, the COPY fails: nconway=# create table test (a int, b text default 'def value'); CREATE TABLE nconway=# copy test from stdin; >> 5 >> \. nconway=# copy test from stdin; >> 10 >> 15 >> \. ERROR: copy: line 2, Memory exhausted in AllocSetAlloc(1065320379) I think I've mismanaged the memory contexts involved somehow, but I'm not sure what the problem is. Any help would be appreciated... Cheers, Neil -- Neil Conway <neilconway@rogers.com> PGP Key ID: DB3C29FC
Вложения
В списке pgsql-patches по дате отправления: