Re: Information about columns - Mailing list pgsql-general

From Dario Teixeira
Subject Re: Information about columns
Date
Msg-id 977541.74858.qm@web111503.mail.gq1.yahoo.com
Whole thread Raw
In response to Information about columns  (Dario Teixeira <darioteixeira@yahoo.com>)
Responses Re: Information about columns
List pgsql-general
Hi,

> Why do you think that's a useful activity for client-side
> code to engage in?

Strongly typed languages like Ocaml and Haskell deal with the possibility
of missing values by having "option types".  Though at first glance SQL's
NULL seems like a similar concept, in fact NULL is more like a constraint
on a table column instead of defining a different type.  This impedance
mismatch causes some trouble when writing bindings that aim to preserve
type-safety.

I doubt there is a clean way around this (barring Postgresql implementing
option types).  Therefore, I'm working on a workaround that involves the
Postgresql side annotating the nullability of type definitions by issuing
comments on the type (using COMMENT ON).  Yes, it is a hack, but will solve
my problem as long as I can determine the return type (and thus fetch its
comment) associated with a query.

I know other people faced this problem before when writing Ocaml or Haskell
bindings, and that is why I know there is no straightforward solution.  Still,
I welcome any thinking-outside-the-box suggestions...

Cheers,
Dario Teixeira





pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Replication
Next
From: Grzegorz Jaśkiewicz
Date:
Subject: Re: Please suggest me on my table design (indexes!)