Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 904B4B5DC42 for ; Sat, 10 Sep 2011 02:59:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 43844-01 for ; Sat, 10 Sep 2011 05:59:34 +0000 (UTC) X-Greylist: delayed 00:07:56.976266 by SQLgrey-1.7.6 Received: from forward16.mail.yandex.net (forward16.mail.yandex.net [95.108.253.141]) by mail.postgresql.org (Postfix) with ESMTP id B62B7B5DBDA for ; Sat, 10 Sep 2011 02:59:33 -0300 (ADT) Received: from web20.yandex.ru (web20.yandex.ru [95.108.253.229]) by forward16.mail.yandex.net (Yandex) with ESMTP id 7C22ED4143C; Sat, 10 Sep 2011 09:51:29 +0400 (MSD) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1315633889; bh=udrMXGhDeTzc6vnAdYm0yaN6Q5bwo8UqXnnkYxqNqIY=; h=From:To:Cc:In-Reply-To:References:Subject:MIME-Version:Message-Id: Date:Content-Transfer-Encoding:Content-Type; b=vZFL+li5nAlPHk5E39ZfEQHXF0IFw/Fygs3EtF9g4Ia1BoRNgMZiXDrm/I6FONXm5 6lrhdVZ+taiZEOsersq7SR1fihRnvp9NiW3AhLf87QAApwTlNzLXsWqb+rAMMLOusX ISVgimnFgxSAax69sOQty4VQ986BzJ7wu0m4J2JM= Received: from localhost (localhost.localdomain [127.0.0.1]) by web20.yandex.ru (Yandex) with ESMTP id 5AA0861882F4; Sat, 10 Sep 2011 09:51:29 +0400 (MSD) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1315633889; bh=udrMXGhDeTzc6vnAdYm0yaN6Q5bwo8UqXnnkYxqNqIY=; h=From:To:Cc:In-Reply-To:References:Subject:MIME-Version:Message-Id: Date:Content-Transfer-Encoding:Content-Type; b=vZFL+li5nAlPHk5E39ZfEQHXF0IFw/Fygs3EtF9g4Ia1BoRNgMZiXDrm/I6FONXm5 6lrhdVZ+taiZEOsersq7SR1fihRnvp9NiW3AhLf87QAApwTlNzLXsWqb+rAMMLOusX ISVgimnFgxSAax69sOQty4VQ986BzJ7wu0m4J2JM= X-Yandex-Spam: 1 Received: from [2.94.17.3] ([2.94.17.3]) by web20.yandex.ru with HTTP; Sat, 10 Sep 2011 09:51:28 +0400 From: msi77 To: shuaixf Cc: pgsql-sql@postgresql.org In-Reply-To: <1315572818036-4786248.post@n5.nabble.com> References: <1315451354762-4780987.post@n5.nabble.com> <1315572818036-4786248.post@n5.nabble.com> Subject: Re: Re: how can I get the length of columns of a table by system tables/views MIME-Version: 1.0 Message-Id: <531401315633888@web20.yandex.ru> Date: Sat, 10 Sep 2011 09:51:28 +0400 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=koi8-r X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.677 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.1, FREEMAIL_FROM=0.001, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201109/16 X-Sequence-Number: 35816 Why not to use information schema: select column_name, character_maximum_length from information_schema.columns where table_name ='table name' 09.09.2011, 16:53, "shuaixf" : > SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod) > FROM pg_catalog.pg_attribute a > WHERE a.attrelid = (SELECT pg_class.oid > ššššššššššššššššššššFROM pg_class INNER JOIN pg_namespace > šššššššššššššššššššššššON (pg_class.relnamespace = pg_namespace.oid > šššššššššššššššššššššššššššAND lower(pg_namespace.nspname) = 'public') > šššššššššššššššššššWHERE pg_class.relname='tablename') > ššAND a.attnum > 0 AND NOT a.attisdropped > ORDER BY a.attnum; > > -- > View this message in context: http://postgresql.1045698.n5.nabble.com/how-can-I-get-the-length-of-columns-of-a-table-by-system-tables-views-tp4780987p4786248.html > Sent from the PostgreSQL - sql mailing list archive at Nabble.com. > > -- > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql