Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1EF4F632BD1 for ; Sat, 6 Jun 2009 07:32:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 18904-09 for ; Sat, 6 Jun 2009 07:32:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.enyo.de (mail.enyo.de [212.9.189.167]) by mail.postgresql.org (Postfix) with ESMTP id 19EAF63255B for ; Sat, 6 Jun 2009 07:32:10 -0300 (ADT) Received: from deneb.vpn.enyo.de ([212.9.189.177] helo=deneb.enyo.de) by mail.enyo.de with esmtp id 1MCtC3-0005j6-Ig; Sat, 06 Jun 2009 12:32:07 +0200 Received: from fw by deneb.enyo.de with local (Exim 4.69) (envelope-from ) id 1MCtC3-0004Hh-Ay; Sat, 06 Jun 2009 12:32:07 +0200 From: Florian Weimer To: Tom Lane Cc: pgsql-interfaces@postgresql.org Subject: Re: Type OIDs References: <877hztupfn.fsf@mid.deneb.enyo.de> <10172.1244057188@sss.pgh.pa.us> Date: Sat, 06 Jun 2009 12:32:07 +0200 In-Reply-To: <10172.1244057188@sss.pgh.pa.us> (Tom Lane's message of "Wed, 03 Jun 2009 15:26:28 -0400") Message-ID: <87r5xxwt3s.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/4 X-Sequence-Number: 6872 * Tom Lane: > Florian Weimer writes: >> Can I embed the types I'm interested in into my program, or should I >> query the server at least once per connection to get the mapping? I'm >> interested in types such as INTEGER, TEXT, BYTEA, etc. No user >> defined types, and nothing fancy. Ultra-long-term portability isn't >> required, either. > > Well, the type OIDs of the standard built-in types haven't changed in > at least ten years, but that doesn't mean we won't change 'em in the > future. I'd advise at least using the #define's from pg_type.h rather > than writing actual numeric constants. Okay, will do that. Thanks. By the way, the binary encoding would be pretty useful for BYTEA columns and parameters, but it's a pretty hefty burden for almost anything else. Wouldn't it make sense to add a format flag which basically says "binary if it's BYTEA, otherwise text"? I don't think many host languages make a strong distinction between BYTEA and TEXT types (except those which use UTF-16 and expose that to the user, like Java and C#). As a result, it is difficult to specify the right types when talking to the server. You don't want to label a column as BYTEA overeagerly because it will break type inference on the SQL side (I think).