Re: Selecting a constant question
| От | Tom Lane |
|---|---|
| Тема | Re: Selecting a constant question |
| Дата | |
| Msg-id | 21188.1181593946@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Selecting a constant question ("Dann Corbit" <DCorbit@connx.com>) |
| Ответы |
Re: Selecting a constant question
|
| Список | pgsql-hackers |
"Dann Corbit" <DCorbit@connx.com> writes:
> The issue is this:
> Postgres describes the column with a typmod of -1 (unknown) and a length
> of 65534.
Oh, you're looking at typlen not typmod. Please observe the comments in
pg_type.h:
/* * For a fixed-size type, typlen is the number of bytes we use to * represent a value of this type, e.g. 4 for an
int4. But for a * variable-length type, typlen is negative. We use -1 to indicate a * "varlena" type (one that has a
lengthword), -2 to indicate a * null-terminated C string. */int2 typlen;
You should be treating typlen as signed not unsigned, and not assuming a
fixed width for any negative value.
Since the width refers to the server internal representation, and not to
what comes down the wire, I find it pretty strange for an application to
be using typlen for anything at all actually.
regards, tom lane
В списке pgsql-hackers по дате отправления: