Skip site navigation (1) Skip section navigation (2)

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

From: "Pavlo Baron" <pb(at)pbit(dot)org>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)
Date: 2001-12-27 11:05:55
Message-ID: 003001c18ec6$752e6c50$6500a8c0@bw1 (view raw or flat)
Thread:
Lists: 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(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.



rgds
Pavlo Baron

Attachment: patch
Description: application/octet-stream (5.0 KB)

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-12-27 15:11:21
Subject: Re: patch: INSERT INTO t VALUES (a, b, ..., DEFAULT, ...)
Previous:From: Bruce MomjianDate: 2001-12-27 06:14:50
Subject: Problem with TOAST column corruption

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group