Re: Find datatype of a column during the backend flow

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Ishaya Bhatt <ishayabhatt(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Find datatype of a column during the backend flow
Date: 2013-11-10 23:40:01
Message-ID: CAL_0b1v1U5Vapv2mYujixiq7c-+k85BNu=dp4zH7gWDo4A8oxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, Nov 9, 2013 at 7:27 AM, Ishaya Bhatt <ishayabhatt(at)gmail(dot)com> wrote:
> In the sorting code, I need to determine the datatype of my sort keys
> and call some code conditionally based on the datatype. Is there any way to
> determine the datatype of a column from the backend PostGreSQL code. I am
> aware of the methods PSQLexec() and PQftype() but am unable to figure out
> how to call these functions from the backend. Any help on this or any other
> method to determine datatype would be very much appreciated.

You could probably use polymorphic stored functions to execute
different code depending on types.

Could you please provide a query?

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

http://www.linkedin.com/in/grayhemp
+1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979
gray(dot)ru(at)gmail(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Craig R. Skinner 2013-11-12 18:17:44 Function args: TEXT -vs- VARCHAR?
Previous Message Michael Schmidt 2013-11-09 23:20:59 Re: How to script inserts where id is needed as fk