Обсуждение: Data type OIDs
Hi all, just a very quick question: Does OID of each data type stays the same in any installation of PostgreSql and when database is used e.g. OID for data type "bool" is 16, "char" is 18 etc. Or is the case that this identifiers can change? Thanks! |
Hi all, just a very quick question: Does OID of each data type stays the same in any installation of PostgreSql and when database is used e.g. OID for data type "bool" is 16, "char" is 18 etc. Or is the case that this identifiers can change?
Thanks!
Hi Thom, well, it relates to reading/writing data using PostgreSQL protocol (v3). For example RowDescription message uses type OID to identify data type of the field. Same as with Parse message I need to specify OID of the parameter data type. As a result I want to declare an enum of all used data types and assignd PostgreSQL data type OID to appropriate value - so development could be a little more intuitive.
Background: as part of my summer project I have to create fast .NET (C#) provider to work with PostgreSQL database. Right now I have implemented connectivity and simple query handling. So now it all about extended query handling.
Oh and I have another question (that may not realate to this post as all): Is it possible to send Parse, Bind and Execute messages in a single batch to the database without sending them one by one and waiting for appropriate result?
Thanks!
--- On Tue, 6/7/10, Thom Brown <thombrown@gmail.com> wrote:
From: Thom Brown <thombrown@gmail.com>
Subject: Re: [NOVICE] Data type OIDs
To: "Greg" <grigorey@yahoo.co.uk>
Cc: pgsql-novice@postgresql.org
Date: Tuesday, 6 July, 2010, 23:15On 6 July 2010 23:12, Greg <grigorey@yahoo.co.uk> wrote:
Hi all, just a very quick question: Does OID of each data type stays the same in any installation of PostgreSql and when database is used e.g. OID for data type "bool" is 16, "char" is 18 etc. Or is the case that this identifiers can change?
Thanks!I'm worried that the reason that you're asking is because you wish to use the oids elsewhere. Don't rely on oids. Those are for internal use only. Have a look at pg_type for information on data types.Why exactly are you asking? What are you trying to do?Thom
On 07/07/2010 01:15 AM, Greg wrote: > Hi Thom, well, it relates to reading/writing data using PostgreSQL > protocol (v3). For example RowDescription message uses type OID to > identify data type of the field. Same as with Parse message I need to > specify OID of the parameter data type. As a result I want to declare an > enum of all used data types and assignd PostgreSQL data type OID to > appropriate value - so development could be a little more intuitive. I don't think there is any promise that type OIDs will never change, but in practice they have been stable for many releases over 10+ years. You should, however, use the macros in pg_type.h to refer to them, e.g. INT8OID, TEXTOID, etc. HTH, Joe -- Joe Conway credativ LLC: http://www.credativ.us Linux, PostgreSQL, and general Open Source Training, Service, Consulting, & Support
Вложения
Cool. Thanks Joe! Thats exactly what I needed to know. --- On Wed, 7/7/10, Joe Conway <mail@joeconway.com> wrote:
|