patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)

Поиск
Список
Период
Сортировка
От Pavlo Baron
Тема patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)
Дата
Msg-id 003001c18ec6$752e6c50$6500a8c0@bw1
обсуждение исходный текст
Ответы Re: patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
hello hackers

here is the patch for the INSERT INTO t VALUES (..., DEFAULT, ...) from the
current TODO list.
It's my first patch so please forgive me if it's not the best solution - I'm
now learning about the codebase and this implementation really hunted me
through some deep and dark places...
Your comments on how to do it right or what is additionally to do are
welcome, of course

Well, here how it works:

1. only 3 files are related, all from the src/backend/parser
2. my comments are all beginning with "pavlo (pb@pbit.org)"
3. gram.y - here I added a rule for the DEFAULT-element in the target_list
used for the INSERT-statement. It now replaces DEFAULT by an anti-thing like
"@default" because I couldn't find out were it fails if I leave DEFAULT
unchainged. If smb. knows a way to do it I'll drop this @default
4. parse_coerce.c - coerce_type - here I faked the standard handling failing
when it tries to convert the @default-string
5. parse_target.c - updateTargetListEntry - here the @default-string is
handled. I just look up if there is a default value for the column and use
it instead of the @default place holder
6. I tested it with psql
7. I tested it under Sun Solaris8 SPARC and FreeBSD 4.0 Intel
8. I used "cvs diff > patch" to diff changes

Please let me know if it's ok or if some changes must be done.



rgds
Pavlo Baron

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Problem with TOAST column corruption
Следующее
От: Tom Lane
Дата:
Сообщение: Re: patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)