Skip site navigation (1) Skip section navigation (2)

Re: Opaque data type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Burski <john(dot)burski(at)911ep(dot)com>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Opaque data type
Date: 2001-08-16 14:43:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
John Burski <john(dot)burski(at)911ep(dot)com> writes:
> Could someone clarify the concept that underlies the opaque data type?

It *is* confusing, because OPAQUE is actually used for several distinct
purposes.  If you look in the pg-hackers mail list archives, you'll find
discussions (as yet unimplemented) to replace OPAQUE by several
pseudo-types that have crisper meanings.

Offhand I can recall these uses:

* Sometimes OPAQUE means "this function doesn't return anything at all",
  similarly to "returns void" in C and some other languages.

* Sometimes OPAQUE means "this value can be any datatype at all" (eg,
  input of the count() aggregate).

* Sometimes OPAQUE means "I know exactly what this should be, but it's
  an internal datatype with no SQL-level equivalent".  This is usually
  what's at stake with a trigger function.

* Sometimes OPAQUE means "I know exactly what this should be, but I
  haven't declared it yet" (ie, a forward reference).  This is needed
  to declare I/O functions of user-defined types, since the system
  requires the functions to already exist when the type is declared.

Confused yet?  Basically, OPAQUE has been used as an easy out in rather
more places than it should have been :-(.  Someday we'll clean this up.

			regards, tom lane

In response to


pgsql-novice by date

Next:From: John BurskiDate: 2001-08-16 15:03:39
Subject: Re: Opaque data type
Previous:From: John BurskiDate: 2001-08-16 13:59:48
Subject: Opaque data type

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group