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(at)pbit(dot)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.
Description: application/octet-stream (5.0 KB)
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2001-12-27 15:11:21|
|Subject: Re: patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...) |
|Previous:||From: Bruce Momjian||Date: 2001-12-27 06:14:50|
|Subject: Problem with TOAST column corruption|