Re: Can a view represent a schedule for all days into the future?

From: David Johnston <polobo(at)yahoo(dot)com>
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 17:42:47
Message-ID: 1381426967827-5774076.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Mackler-3 wrote
> http://stackoverflow.com/questions/19237450/can-sql-view-have-infinite-number-of-rows-repeating-schedule-each-row-a-day
>
> I currently have a user-defined function that returns the results I
> want, but the problem is in the invocation: Some host-language client
> libraries aren't so graceful with user-defined functions, especially
> when they return multiple rows of multiple columns.

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.

The use-case you are stating is best solved via the creation of a
user-defined function. I would implement that and then, in the off chance
there is some kind of client-library interface issue, solve that specific
problem when it arises. Implementing a less-than-ideal solution today for a
problem that may never even come up is foolish.

More specifically you cannot model infinity in this situation. The best you
could do is use "generate_series(...)" to construct and appropriately large
domain of values which would then be filtered.

If you want to provide a concrete situation that you must handle and that
the function-invocation form of the API will not work please do so and maybe
some advice can be provided to solve that problem. Unless and until you can
do that just use the function-invocation form and be content.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Can-a-view-represent-a-schedule-for-all-days-into-the-future-tp5774069p5774076.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc Mamin 2013-10-10 18:25:56 Re: Why doesn't update syntax match insert syntax?
Previous Message Adam Mackler 2013-10-10 17:16:48 Can a view represent a schedule for all days into the future?