Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 2A0509FB1E4 for ; Fri, 19 Jan 2007 02:44:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 46038-10 for ; Fri, 19 Jan 2007 02:44:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail1.fujitsu.com.au (mail1.fujitsu.com.au [216.14.192.229]) by postgresql.org (Postfix) with ESMTP id DB6D39FB1B9 for ; Fri, 19 Jan 2007 02:44:14 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail1.fujitsu.com.au (Postfix) with ESMTP id 9E8DB603BE; Fri, 19 Jan 2007 17:44:13 +1100 (EST) Received: from mail1.fujitsu.com.au ([127.0.0.1]) by localhost (mail1.fujitsu.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 29375-01-69; Fri, 19 Jan 2007 17:44:13 +1100 (EST) Received: from mailfilter1.au.fjanz.com (mailfilter1.au.fjanz.com [137.172.19.78]) by mail1.fujitsu.com.au (Postfix) with ESMTP id BD5F8603B1; Fri, 19 Jan 2007 17:44:12 +1100 (EST) X-SEF-Processed: 5_0_0_816__2007_01_19_17_44_12 Received: from Unknown [137.172.75.51] by mailfilter1.au.fjanz.com - SurfControl E-mail Filter (5.0.1); Fri, 19 Jan 2007 17:44:12 +1100 Received: from fast.fujitsu.com.au (localhost.localdomain [127.0.0.1]) by fast.fujitsu.com.au (8.13.1/8.13.1) with ESMTP id l0J6gCIQ025978; Fri, 19 Jan 2007 17:42:12 +1100 Received: from fast.fujitsu.com.au (root@localhost) by fast.fujitsu.com.au (8.13.1/8.13.1/Submit) with ESMTP id l0J6gBKU025977; Fri, 19 Jan 2007 17:42:11 +1100 Received: from there (unknown 137.172.75.153) by fast.fujitsu.com.au (Scalix SMTP Relay 10.0.1.3) via ESMTP; Fri, 19 Jan 2007 17:42:11 +1100 (EST) Date: Sat, 20 Jan 2007 04:44:51 +1100 From: "FAST PostgreSQL" Reply-To: "FAST PostgreSQL" To: Neil Conway Cc: pgsql-patches@postgresql.org Message-ID: <12753.10921169188931.fast.fujitsu.com.au@MHS> In-Reply-To: <1169186550.27197.10.camel@localhost.localdomain> References: <12753.10901169180733.fast.fujitsu.com.au@MHS> References: <1169186550.27197.10.camel@localhost.localdomain> Subject: Re: pg_get_domaindef x-scalix-Hops: 1 Organization: FAST X-Mailer: KMail [version 1.3.2] MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at mail1.fujitsu.com.au X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/348 X-Sequence-Number: 156 On Fri, 19 Jan 2007 17:02, Neil Conway wrote: > On Sat, 2007-01-20 at 02:28 +1100, FAST PostgreSQL wrote: > > Attached is a small patch that implements the pg_get_domaindef(oid) > > function. > > A few minor comments: > > - don't use C++-style comments OK. Can do. > > - why does this code append a "-" to the output when SPI_processed != 1, > rather than erroring out? get_ruledef() does the same. As the user gets a '-' in that case when a non-existent oid is given, I just wanted to be consistent. Maybe a wrong idea ? > > - you probably want to elog(ERROR) if typeTuple is invalid: Of course. > + if (typnotnull || constraint != NULL) > + { > + if ( ( (contype != NULL) && (strcmp(contype, > "c") != 0) ) || typnotnull ) > + { > + appendStringInfo(&buf, "CONSTRAINT "); > + } > + if (typnotnull) > + { > + appendStringInfo(&buf, "NOT NULL "); > + } > + } > + if (constraint != NULL) > + { > + appendStringInfo(&buf, > quote_identifier(constraint)); > + } > > This logic seems pretty awkward. Perhaps simpler would be a check for > typnotnull (and then appending "CONSTRAINT NOT NULL"), and then handling > the non-typnotnull branch separately. Yeah agree. > > -Neil Rgds, Arul Shaji This is an email from Fujitsu Australia Software Technology Pty Ltd, ABN 27 003 693 481. It is confidential to the ordinary user of the email address to which it was addressed and may contain copyright and/or legally privileged information. No one else may read, print, store, copy or forward all or any of it or its attachments. If you receive this email in error, please return to sender. Thank you. If you do not wish to receive commercial email messages from Fujitsu Australia Software Technology Pty Ltd, please email unsubscribe@fast.fujitsu.com.au