From sandhyar@amiindia.co.in Thu Dec 22 05:35:10 2005 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 C2E519DC8AF for ; Thu, 22 Dec 2005 01:35:10 -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 11375-08 for ; Thu, 22 Dec 2005 01:34:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by postgresql.org (Postfix) with ESMTP id 50F639DC81D for ; Thu, 22 Dec 2005 01:34:45 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by venus.amiindia.co.in (8.12.11/8.12.11) with SMTP id jBM5UJPo013457 for ; Thu, 22 Dec 2005 11:00:20 +0530 Received: from amiindiahjwbgh (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id 02069332935; Thu, 22 Dec 2005 10:53:26 +0530 (IST) Message-ID: <001001c606b9$80b50060$cd00000a@amiindiahjwbgh> From: "sandhya" To: "postgre" Cc: "sandhya" Subject: How to get OID return value(pls help me) Date: Thu, 22 Dec 2005 11:05:22 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000D_01C606E7.9A3C6860" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-imss-version: 2.5 X-imss-result: Passed X-imss-scores: Clean:85.94160 C:18 M:1 S:5 R:5 X-imss-settings: Baseline:5 C:3 M:3 S:4 R:3 (0.2500 0.7500) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.002 required=5 tests=[AWL=-0.000, HTML_MESSAGE=0.001, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.002 X-Spam-Level: X-Archive-Number: 200512/264 X-Sequence-Number: 19984 This is a multi-part message in MIME format. ------=_NextPart_000_000D_01C606E7.9A3C6860 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi...... 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. But my problem is the return value of the datatype i am getting from the = query result is char*. Is there any function in postgresql which gives the return value of the = executed query as OID type. Please explain me what to do inorder to get the Oid type=20 When i used PQoidValue(res).It is giving 0. Also in document they mention something related to INSERT query only. But i want it for select query. Thank you, Regards, Sandhya ------=_NextPart_000_000D_01C606E7.9A3C6860 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi......
 
 
My table consists of oid and=20 varchar datatypes.
I want to get the oid type from = the=20 table and i need to pass it to a function = which=20 accepts only the oid data type.
But my problem is the=20 return value of the datatype i am getting from = the=20 query result is char*.
Is there any function in=20 postgresql which gives the return value of the = executed query as OID type.
 
Please explain me what to do inorder to = get the Oid=20 type
When i used PQoidValue(res).It is = giving=20 0.
Also in document they mention something = related to=20 INSERT query only.
But i want it for select = query.
Thank you,
Regards,
Sandhya
------=_NextPart_000_000D_01C606E7.9A3C6860-- From mike@fuhr.org Thu Dec 22 06:31:24 2005 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 From sandhyar@amiindia.co.in Thu Dec 22 07:39:11 2005 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 B2F229DC9D3 for ; Thu, 22 Dec 2005 03:39:11 -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 32930-02 for ; Thu, 22 Dec 2005 03:39:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from venus.amiindia.co.in (unknown [203.199.198.234]) by postgresql.org (Postfix) with ESMTP id 95DBA9DC9F2 for ; Thu, 22 Dec 2005 03:39:01 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by venus.amiindia.co.in (8.12.11/8.12.11) with SMTP id jBM7YcdU007711; Thu, 22 Dec 2005 13:04:39 +0530 Received: from amiindiahjwbgh (unknown [10.0.0.205])by venus.amiindia.co.in (Postfix) with ESMTP id 30420332941; Thu, 22 Dec 2005 13:04:35 +0530 (IST) Message-ID: <00c201c606cb$d361af40$cd00000a@amiindiahjwbgh> From: "sandhya" To: "Michael Fuhr" Cc: "postgre" , "sandhya" Subject: Fw: How to get OID return value(pls help me) Date: Thu, 22 Dec 2005 13:16:31 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-imss-version: 2.5 X-imss-result: Passed X-imss-scores: Clean:99.90000 C:21 M:2 S:5 R:5 X-imss-settings: Baseline:5 C:3 M:3 S:4 R:3 (0.2500 0.7500) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.009 required=5 tests=[AWL=0.008, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.009 X-Spam-Level: X-Archive-Number: 200512/268 X-Sequence-Number: 19988 ----- Original Message ----- From: "sandhya" To: "Michael Fuhr" Sent: Thursday, December 22, 2005 1:15 PM Subject: Re: [ADMIN] How to get OID return value(pls help me) > What function is that? What does it do with the oid? > > It is normal C function ...with that oid it tries to open the object which i > stored in database. > > You don't mention what language and interface you're using but it > sounds like C and libpq. > Yes...it's C-libpq only > > and use strtoul() to convert the char * to an unsigned > This solved my problem. > Thank you very much Michael. > > Regards, > Sandhya > > > ----- Original Message ----- > From: "Michael Fuhr" > To: "sandhya" > Cc: "postgre" > Sent: Thursday, December 22, 2005 12:01 PM > Subject: Re: [ADMIN] How to get OID return value(pls help me) > > > > 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 > > >