pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
view on system tables upgrade?
2+ messages / 2 participants
[nested] [flat]

* view on system tables upgrade?
@ 1970-01-01 00:00 Christoph Haller <ch@rodos.fzk.de>
  2002-04-26 16:04 ` Re: view on system tables upgrade? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Christoph Haller @ 1970-01-01 00:00 UTC (permalink / raw)
  To: pgsql-sql

I've moved from 7.1.2 to 7.2.1 and now 
a view does no longer work as intended 

create view pgsql_usertables as 
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 ;

CREATE TABLE catsource
	(sid		INTEGER		NOT NULL,
	 name		VARCHAR(64) 	NOT NULL,
	 entrancetime	DATETIME	NOT NULL
) ; 

select col_type,col_length,col_null,col_seq,col_name,col_default 
 from pgsql_usertables where tbl_name='CATSOURCE' order by col_seq ; 

retrieves 
 col_type | col_length | col_null | col_seq | col_name | col_default
----------+------------+----------+---------+----------+-------------
       23 |          4 |        0 |       1 | SID      |           0
     1043 |         64 |        0 |       2 | NAME     |           0
(2 rows)

All columns of type timestamp have disappeared. 
Can somebody please give me a hint what happened. 

Regards, Christoph 



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: view on system tables upgrade?
  1970-01-01 00:00 view on system tables upgrade? Christoph Haller <ch@rodos.fzk.de>
@ 2002-04-26 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-04-26 16:04 UTC (permalink / raw)
  To: Christoph Haller <ch@rodos.fzk.de>; +Cc: pgsql-sql

Christoph Haller <ch@rodos.fzk.de> writes:
> All columns of type timestamp have disappeared. 
> Can somebody please give me a hint what happened. 

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.)

If you need timestamp arrays I'd suggest

UPDATE pg_type SET typelem = 1114 WHERE oid = 1115;

Unfortunately we cannot fix this in the 7.2.* series since we have no
way to fix it in the distribution short of initdb.  It'll be fixed
in the 7.3 release though.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-04-26 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1970-01-01 00:00 view on system tables upgrade? Christoph Haller <ch@rodos.fzk.de>
2002-04-26 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox