Re: [GENERAL] Length of field names.

From: Stuart Rison <stuart(at)NOJUNK_ludwig(dot)ucl(dot)ac(dot)uk>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Length of field names.
Date: 1998-07-13 18:02:07
Message-ID: l03110706b1cff972b391@[128.40.242.190]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>> So my guess is that with the original name, malignant_pathologies_invasive
>> and the primary key created by it (normally
>> malignant_pathologies_invasive_pkey) end up having the same name because of
>> the cut-off?
>>
>> Does this seem right? If so, what is the max length of field names and can
>> anyone suggest a way around this problem (obviously I could just give the
>> tables shorter names but they are computer generated by a Perl script and
>> if at all possible, I'd like to keep the filed and table names in this long
>> format).
>
>max length is 31.
>
>> PS. For those that have been following the \dt <regex> discussion, in this
>> case I would have like a '\d \dt' kind of query to get PG to give me the
>> type and length of the Field field (which is more of an SQL query type of
>> question so probably would have required SQL access to catalog tables as
>> Herouth suggested).
>
>Huh? Doesn't \d \dt do that if you supply the table name?

Yeah I guess I didn't explain that very well. Suppose you did

\d test

you'd get

Field | Type | Length
------------------------------
blah | text | var
number | int2 | 2
code | char() | 15

[hand-made table :)]

now what is was -badly- trying to say was that is you did a \d of that
table you'd get:

Field | Type | Length
-----------------------------------
Field | varchar() | 31
Type | varchar() | 10
Length | int2 | 2

[or something like that, I'm guessing the numbers/types]

so a sort of \d on a \d which would have given me the max length of field.
If I understood Herouth's mail properly, all this information (i.e. catalog
table) are store as 'hidden' tables in the DBMS. In Oracle it appears
these are actually 'usable' in SQL statements -if you know their names and
he was suggesting that the same could be of postgreSQL (I'm sorry if I got
that all wrong Herouth).

cheers,

Stuart.

PS. That leaves me with giving tables and fields smaller names... I
suppose names of over 31 are pretty silly anyway... no wonder I keep
exceeding the query buffer!!

+-------------------------+--------------------------------------+
| Stuart Rison | Ludwig Institute for Cancer Research |
| Tel. (0171) 878 4041 | Courtauld Building |
| Fax. (0171) 878 4040 | 91 Riding House Street |
+-------------------------+ London, W1P 8BT |
| stuart(at)ludwig(dot)ucl(dot)ac(dot)uk | UNITED KINGDOM. |
+-------------------------+--------------------------------------+

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 1998-07-13 18:54:28 Re: [GENERAL] Length of field names.
Previous Message Bruce Momjian 1998-07-13 17:45:19 Re: [GENERAL] Length of field names.