pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ragnar <gnari@hive.is>
To: AKHILESH GUPTA <akhilesh.davim@gmail.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] to count no of columns in a table
Date: Thu, 16 Feb 2006 09:40:36 +0000
Message-ID: <1140082836.32324.38.camel@localhost.localdomain> (raw)
In-Reply-To: <ad39daf90602160113u710dbdafq56359adfe8aee572@mail.gmail.com>
References: <ad39daf90602160113u710dbdafq56359adfe8aee572@mail.gmail.com>

On fim, 2006-02-16 at 14:43 +0530, AKHILESH GUPTA wrote:
> i just want to know one thing that is there any function in PGSQL
> which gives me the total number of columns in a table.
> OR
> just like we are using count(*), it gives us total number or rows in a
> table, just like i want to know the total number of columns present in
> the table

this is the kind of thing the information_schema is for

  select count(*) from information_schema.columns 
                  where table_name='x';


gnari





view thread (4+ messages)

Message-ID: <1140082836.32324.38.camel@localhost.localdomain>
Permalink:  ../1140082836.32324.38.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1140082836.32324.38.camel@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gnari@hive.is, akhilesh.davim@gmail.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] to count no of columns in a table
  In-Reply-To: <1140082836.32324.38.camel@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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