Re: populating arrays with default values

From: Kenneth Porter <shiva(at)sewingwitch(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Cc: "G(dot) J(dot) Walsh" <gjwalsh(at)dscdirectionalservices(dot)com>
Subject: Re: populating arrays with default values
Date: 2007-11-15 02:30:48
Message-ID: 8AA8868C46F72EEB0E94FB36@[10.169.6.155]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wednesday, November 14, 2007 12:09 PM -0800 "G. J. Walsh"
<gjwalsh(at)dscdirectionalservices(dot)com> wrote:

> I come from a long background with C and isam. Moving into php and
> postgresql is therefore not all that strange, but I suffer with the
> comparative lack of structure at times.

Same here. I'm a power C++ guy but relatively new at SQL. I can read it but
not yet write it fluently.

> I deal with a lot of psych scoring and am establishing tables which will
> contain the response patterns for each individual test within a battery.
> In defining this, I plan on something like: ans CHAR(1) ARRAY[192]
>
> But I learned that PostgreSQL does not 'enforce' this. I would rather
> have an '?' placed in each of the 192 array elements (and thereby
> constrain with NOT NULL) to indicate lack of a response (the default)
> when the test records are first established for the client.

Instead of a char, could you use an enumeration? Are there in fact 256
distinct answers for each array position? (I'm not certain that SQL, or the
PostgreSQL dialect, have such a thing.)

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Kenneth Porter 2007-11-15 02:45:54 Access rights for tablespaces, phpPgAdmin versus PgAdmin
Previous Message Tom Lane 2007-11-14 23:03:42 Re: array indizes in SQL