X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 211E89DC8AF for ; Thu, 22 Dec 2005 02:31:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19050-08 for ; Thu, 22 Dec 2005 02:31:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id BE3B09DC81D for ; Thu, 22 Dec 2005 02:31:21 -0400 (AST) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id jBM6VBhp097671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Dec 2005 23:31:15 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.4/8.13.4) with ESMTP id jBM6VB1B063818; Wed, 21 Dec 2005 23:31:11 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.4/8.13.4/Submit) id jBM6VAFd063817; Wed, 21 Dec 2005 23:31:11 -0700 (MST) (envelope-from mfuhr) Date: Wed, 21 Dec 2005 23:31:10 -0700 From: Michael Fuhr To: sandhya Cc: postgre Subject: Re: How to get OID return value(pls help me) Message-ID: <20051222063110.GA63701@winnie.fuhr.org> References: <001001c606b9$80b50060$cd00000a@amiindiahjwbgh> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001001c606b9$80b50060$cd00000a@amiindiahjwbgh> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.039 required=5 tests=[AWL=0.039] X-Spam-Score: 0.039 X-Spam-Level: X-Archive-Number: 200512/265 X-Sequence-Number: 19985 On Thu, Dec 22, 2005 at 11:05:22AM +0530, sandhya wrote: > My table consists of oid and varchar datatypes. > I want to get the oid type from the table and i need to pass it to > a function which accepts only the oid data type. What function is that? What does it do with the oid? > But my problem is the return value of the datatype i am getting from > the query result is char*. You don't mention what language and interface you're using but it sounds like C and libpq. > Is there any function in postgresql which gives the return value of > the executed query as OID type. You could rely on the knowledge that Oid is typedef unsigned int Oid; and use strtoul() to convert the char * to an unsigned int. Another way, if you're using 7.4 or later, would be to issue the query with PQexecParams() and request binary results. I think you'll have to deal with byte order issues in that case. This is off-topic for pgsql-admin; pgsql-interfaces or pgsql-general would be more appropriate. -- Michael Fuhr