pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: FAST PostgreSQL <fastpgs@fast.fujitsu.com.au>
To: Neil Conway <neilc@samurai.com>
Cc: pgsql-patches@postgresql.org
Subject: Re: pg_get_domaindef
Date: Sat, 20 Jan 2007 04:44:51 +1100
Message-ID: <12753.10921169188931.fast.fujitsu.com.au@MHS> (raw)
In-Reply-To: <1169186550.27197.10.camel@localhost.localdomain>
References: <12753.10901169180733.fast.fujitsu.com.au@MHS>

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




view thread (21+ messages)  latest in thread

Message-ID: <12753.10921169188931.fast.fujitsu.com.au@MHS>
Permalink:  ../12753.10921169188931.fast.fujitsu.com.au@MHS/
Also on:    postgresql.org/message-id/12753.10921169188931.fast.fujitsu.com.au@MHS

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: fastpgs@fast.fujitsu.com.au, neilc@samurai.com, pgsql-patches@postgresql.org
  Subject: Re: pg_get_domaindef
  In-Reply-To: <12753.10921169188931.fast.fujitsu.com.au@MHS>
  References: <12753.10901169180733.fast.fujitsu.com.au@MHS> <12753.10921169188931.fast.fujitsu.com.au@MHS>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox