pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_attributte, data types
3+ messages / 2 participants
[nested] [flat]

* pg_attributte, data types
@ 2011-03-23 23:05  Viktor Bojović <viktor.bojovic@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Viktor Bojović @ 2011-03-23 23:05 UTC (permalink / raw)
  To: pgsql-sql

while listing data types i have noticed that some types have underscore
prefix but i don't know why is that. so im asking if somene can tell me.
These are type examples:

_char
_float4
_int2
_oid
_regtype
_text
_varchar


select distinct typname
from
(
SELECT attname AS name,
attnum ,
typname,
atttypmod - 4 as length,
attnotnull AS notnull,
atthasdef AS def,
c.oid AS tbloid,
d.adsrc AS defval,
ds.description,
attndims AS dimnum,
attstattarget,
attislocal,
attinhcount

FROM pg_attribute a
INNER JOIN pg_class c ON a.attrelid = c.oid
INNER JOIN pg_type t ON a.atttypid = t.oid
LEFT OUTER JOIN pg_attrdef d ON d.adrelid = c.oid AND d.adnum = a.attnum
LEFT OUTER JOIN pg_description ds ON ds.objoid = c.oid AND ds.objsubid =
a.attnum
INNER JOIN pg_namespace n ON t.typnamespace = n.oid
WHERE attnum > 0 AND
attisdropped <> 't'
ORDER BY a.attnum
) as foo


-- 
---------------------------------------
Viktor Bojović
---------------------------------------
Wherever I go, Murphy goes with me

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

* Re: pg_attributte, data types
@ 2011-03-23 23:56  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Viktor Bojović <viktor.bojovic@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2011-03-23 23:56 UTC (permalink / raw)
  To: Viktor Bojović <viktor.bojovic@gmail.com>; +Cc: pgsql-sql

=?UTF-8?Q?Viktor_Bojovi=C4=87?= <viktor.bojovic@gmail.com> writes:
> while listing data types i have noticed that some types have underscore
> prefix but i don't know why is that. so im asking if somene can tell me.
> These are type examples:

> _char
> _float4
> _int2
> _oid
> _regtype
> _text
> _varchar

Those are array types.  The normal convention is that foo[] is named
"_foo" under the surface.

			regards, tom lane



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

* Re: pg_attributte, data types
@ 2011-03-24 07:49  Viktor Bojović <viktor.bojovic@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Viktor Bojović @ 2011-03-24 07:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

On Thu, Mar 24, 2011 at 12:56 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> =?UTF-8?Q?Viktor_Bojovi=C4=87?= <viktor.bojovic@gmail.com> writes:
> > while listing data types i have noticed that some types have underscore
> > prefix but i don't know why is that. so im asking if somene can tell me.
> > These are type examples:
>
> > _char
> > _float4
> > _int2
> > _oid
> > _regtype
> > _text
> > _varchar
>
> Those are array types.  The normal convention is that foo[] is named
> "_foo" under the surface.
>
>                        regards, tom lane
>

thanx

-- 
---------------------------------------
Viktor Bojović
---------------------------------------
Wherever I go, Murphy goes with me

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


end of thread, other threads:[~2011-03-24 07:49 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 23:05 pg_attributte, data types Viktor Bojović <viktor.bojovic@gmail.com>
2011-03-23 23:56 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-03-24 07:49   ` Viktor Bojović <viktor.bojovic@gmail.com>

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