column length?

Поиск
Список
Период
Сортировка
От Mark McArthey
Тема column length?
Дата
Msg-id CGEFKOCNLBFDGLJODOGIMEJECDAA.mcarthey@execpc.com
обсуждение исходный текст
Ответы Re: column length?
Список pgsql-novice
Hi all,
I am wondering how the column length is determined.  The attached output is
for my test table.  Running '\d player' shows me that the columns are
varchar(20), but the attlen is listed as -1.  Where does the value '20' come
from?
Thanks!
Mark

> psql -E

=# \d player
********* QUERY *********
SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules
FROM pg_class WHERE relname='player'
*************************

********* QUERY *********
SELECT a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull,
a.atthasdef, a
.attnum
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relname = 'player'
AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
ORDER BY a.attnum
*************************

Table "player"
Attribute |    Type     | Modifier
-----------+-------------+----------
name      | varchar(20) |
password  | varchar(20) |


=# \i query1.sql
relhasindex | relkind | relchecks | reltriggers | relhasrules
-------------+---------+-----------+-------------+-------------
f           | r       |         0 |           0 | f
(1 row)

markm=# \i query2.sql
attname  | typname | attlen | atttypmod | attnotnull | atthasdef | attnum
----------+---------+--------+-----------+------------+-----------+--------
name     | varchar |     -1 |        24 | f          | f         |      1
password | varchar |     -1 |        24 | f          | f         |      2
(2 rows)



В списке pgsql-novice по дате отправления:

Предыдущее
От: "Mark McArthey"
Дата:
Сообщение: dynamic #include's?
Следующее
От: Jochem van Dieten
Дата:
Сообщение: Re: Performance question (PostgreSQL 7.1.3)