Re: advice on extensions needed

From: Brook Milligan <brook(at)biology(dot)nmsu(dot)edu>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: advice on extensions needed
Date: 2000-08-25 18:19:30
Message-ID: 200008251819.MAA25810@biology.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> - Is it possible to write functions to automatically convert one
> extended type into another? If so, how should this be done?

A function named the same as a type, with one argument of some other
type, is treated as an implicit type conversion rule by the parser.

Just to make sure I understand. Suppose I create two user-defined
types A and B and want interconversions. I will need the following
functions, right?

/* I/O */
A * A_in (const char *);
char * A_out (const A *);
B * B_in (const char *);
char * B_out (const B *);

/* conversions */
A * A (const B *);
B * B (const A *);

Thanks again.

Cheers,
Brook

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-08-25 18:25:37 Re: Performance on inserts
Previous Message John McKown 2000-08-25 17:56:24 Access PostgreSQL server via SSL/Internet