Re: BUG #5358: Throwing unexpected ERROR
От | Tom Lane |
---|---|
Тема | Re: BUG #5358: Throwing unexpected ERROR |
Дата | |
Msg-id | 27537.1267577460@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #5358: Throwing unexpected ERROR ("Gurjeet Singh" <singh.gurjeet@gmail.com>) |
Ответы |
Re: BUG #5358: Throwing unexpected ERROR
|
Список | pgsql-bugs |
"Gurjeet Singh" <singh.gurjeet@gmail.com> writes: > select relname, pg_relation_size( 'public."' || relname || '"' )/1024 > from (select distinct relname > from (select r.relname, c.attname, c.attnotnull, t.typname > from pg_namespace as s, pg_class as r, pg_attribute as c, pg_type as t > where s.oid = r.relnamespace > and r.oid = c.attrelid > and c.atttypid = t.oid > and s.nspname = 'public' > and t.typname in ('bytea', 'text') ) as s1 > ) as s2 > where pg_relation_size( 'public."' || relname || '"' ) <> 0; > ERROR: relation "public.pg_type" does not exist That approach to generating a textual name for a relation is really pretty unworkable: it's on the hairy edge of being vulnerable to SQL injection attacks, not to mention being inefficient and unwieldy. Just pass r.oid to pg_relation_size, instead. regards, tom lane
В списке pgsql-bugs по дате отправления: