Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id 17BD6475887 for ; Mon, 29 Apr 2002 04:24:33 -0400 (EDT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Mon Apr 29 10:24:26 2002 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id KAA05683; Mon, 29 Apr 2002 10:24:26 +0200 (METDST) From: Christoph Haller Message-Id: <200204290824.KAA19627@rodos> Subject: view on system tables upgrade II To: tgl@sss.pgh.pa.us (Tom Lane) Date: Mon, 29 Apr 2002 10:24:25 METDST Cc: pgsql-sql@postgresql.org In-Reply-To: <26684.1019837065@sss.pgh.pa.us>; from "Tom Lane" at Apr 26, 102 6:07 pm X-Mailer: Elm [revision: 212.4] X-Archive-Number: 200204/352 X-Sequence-Number: 7616 Tom Lane wrote: > > There's a bug in the 7.2.* pg_type table, which I found just a > couple days ago: _timestamp has the wrong typelem. Since your join > assumes every datatype has an array type, it fails to find a join > for timestamp columns. (Should probably use an outer join there, > rather than assuming that.) Sorry, but I cannot figure out where in the join SELECT upper(u.usename) AS TBL_OWNER, upper(t.typname) AS TBL_NAME, upper(a.attname) AS COL_NAME, a.atttypid AS COL_TYPE, int4larger(a.attlen, a.atttypmod - 4) AS COL_LENGTH, CASE WHEN a.attnotnull=true THEN 0 ELSE 1 END AS COL_NULL, a.attnum AS COL_SEQ, CASE WHEN EXISTS(SELECT adsrc FROM pg_attrdef d WHERE d.adrelid = a.attrelid and d.adnum = a.attnum) THEN 1 ELSE 0 END AS COL_DEFAULT from pg_user u, pg_type t, pg_attribute a, pg_type n where u.usesysid = t.typowner and t.typrelid = a.attrelid and t.typtype = 'c' and not (t.typname ~* 'pg_') and n.typelem = a.atttypid and substr(n.typname, 1, 1) = '_' and a.attnum > 0 ; I am assuming every datatype has an array type. Would an outer join solve the current bug? > > If you need timestamp arrays I'd suggest > > UPDATE pg_type SET typelem = 1114 WHERE oid = 1115; > Did the pg_attribute.atttypid resp. pg_type.typelem of timestamp change from 1184 to 1114? If this bug is fixed, what would it become, 1184 or 1114? Regards, Christoph