From: | "Mark McArthey" <mcarthey(at)execpc(dot)com> |
---|---|
To: | "PgSQL Novice" <pgsql-novice(at)postgresql(dot)org> |
Subject: | column length? |
Date: | 2001-10-23 19:25:31 |
Message-ID: | CGEFKOCNLBFDGLJODOGIMEJECDAA.mcarthey@execpc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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)
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-10-23 22:51:20 | Re: Performance question (PostgreSQL 7.1.3) |
Previous Message | Travis Hoyt | 2001-10-23 19:11:51 | [Fwd: views, with check option] |