| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
|---|---|
| To: | Joachim Wieland <joe(at)mcknight(dot)de> |
| Cc: | pgsql-patches(at)postgresql(dot)org |
| Subject: | Re: TODO-Item: TRUNCATE ... CASCADE |
| Date: | 2006-02-02 15:34:28 |
| Message-ID: | 20060202153427.GA5173@surnet.cl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
Joachim Wieland wrote:
> The proposed patch implements TRUNCATE ... CASCADE:
>
> * %Allow TRUNCATE ... CASCADE/RESTRICT
> This is like DELETE CASCADE, but truncates.
>
> The patch also adds a function makeRangeVarFromRelId() to namespace.c that I
> thought would be useful. I hope I didn't overlook something similar that
> exists already.
That's the wrong way to go about it -- better refactor the code so that
a function gets a list of Oids instead of RangeVars, and truncates them.
ExecuteTruncate should build the list and pass it down.
Also I think all the involved relations should be opened and locked
before any of them is touched (so maybe instead of passing Oids you
should be passing Relations).
> + static
> + List* BuildReferencingRelationList(List* oids, List* found_earlier)
Minor stylistic gripe: this should be
static List *
BuildReferencingRelationList(List *oids, List *found_earlier)
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mark Woodward | 2006-02-02 15:57:09 | Re: Multiple logical databases |
| Previous Message | Mark Woodward | 2006-02-02 15:23:44 | Multiple logical databases |