From: | Adam Mackler <postgres(at)mackler(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Can a view represent a schedule for all days into the future? |
Date: | 2013-10-10 20:06:11 |
Message-ID: | 20131010200611.GS26883@mackler.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Oct 10, 2013 at 10:42:47AM -0700, David Johnston wrote:
> Adam Mackler-3 wrote
> > http://stackoverflow.com/questions/19237450/can-sql-view-have-infinite-number-of-rows-repeating-schedule-each-row-a-day
> >
> Not sure how you can state "But I'm willing to agree never to query such a
> view without a WHERE clause that restricts the number of rows." when you
> cannot even guarantee which host-language client libraries you need to
> support.
I'm willing to agree that if I ever query such a view without a WHERE
clause that restricts the number of rows, then I won't blame anyone
but myself for the consequences. If someone can answer this challenge
without imposing that requirement, then I shall be all the more
impressed.
The library I'm using is SLICK:
As far as I can tell it can't handle user-defined functions that
return multiple rows nor multiple columns, except perhaps through some
low-level SQL interface that would defeat my idea of the purpose of
using a database interface library.
As I mention in the post on SO, my understanding of relational
database theory tells me that tables/relations ARE functions, in the
sense of being a mapping between a primary key and a row. So there's
nothing ambiguous about issuing a SELECT query for some particular
date, and if I'm only querying for one date, then there's only one day
in the resulting table.
It wouldn't surprise me if there were some way to create a view based
on underlying tables that contain schedules for each day of the week
that I could query in such a fashion for any day arbitrarily far into
the future. If this is possible, then I would be interested in
knowing what the creation of such a view looks like, independently of
my immediate practical needs. Call me academic.
--
Adam Mackler
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2013-10-10 20:14:58 | Re: Can a view represent a schedule for all days into the future? |
Previous Message | Marc Mamin | 2013-10-10 18:25:56 | Re: Why doesn't update syntax match insert syntax? |