Hi,
I'm having difficulty constructing a query that will find breaks where
data change in a time-series. I've done some searching for this too, but
I haven't found anything.
Here is my example situation, consider my source table:
datebin
2009-01-01 red
2009-01-02 red
2009-01-03
Hi Joel,
Window functions appear to be the best solution for this style of
problem, and I'm looking forward to their applications. However, I'm
sticking with 8.3 for at least a year, so I'm not able to explore this
solution yet. For now, I can only post-process the output in a non-SQL
environ
Scott Marlowe wrote:
On Mon, Jun 15, 2009 at 12:23 PM, Mike Toews wrote:
This is easy to compute using a spreadsheet or in R, but how would I do this
with SQL? I'm using 8.3. Advice is appreciated.
FYI (and I'm no expert in this area) R is available as a pl for
postgres, loo
Hi,
Debugging PL/Python isn't as easy as with PL/pgSQL, as it appears I
can't see line numbers where errors occur. For example:
ERROR: plpython: function "evaluate_something" failed
DETAIL: : sequence index must be integer,
not 'str'
The location of this type of exception is difficult to
ment\n',)
The actual error is on line 8 (not 9), which is a bit odd. Perhaps there
is a "import plpy" inserted somewhere internally.
I noticed that the messages through PL/Python are all tuples with length
1, like this: ("my message",). Why? This doesn't print to
On 1 June 2012 02:36, John Townsend wrote:
> There are least 10 Procedural Languages available for PostGreSQL. The one
> that comes with the installation is PL/pgSQL.
The count looks closer to 18
http://en.wikipedia.org/wiki/PostgreSQL#Procedural_languages
but I doubt some get much use (PL/LOLCOD
Hi,
I have a question that is not specified in the docs[1]. I am using
deferrable constraints in a transaction with SET CONSTRAINTS ALL
DEFERRED. Now I know that DEFERRED constraints are not checked until
transaction COMMIT (i.e., the end), however are they checked with
SAVEPOINT (i.e., part-way i
Hi all,
I'm in the process of debugging some PL/pgSQL functions. I have function
A which calls function B (e.g. on Line 22). The debugging info I'm
interested in is in function B, but I call function A (since there are
other C, D, F functions called from A). However, what I see is really
dist
Tom Lane wrote:
In psql, "\set VERBOSITY terse" might approximate what you want.
This works perfectly in psql (exactly what I wanted). However, I'm most
comfortable using PgAdminIII, and I've tried adding "SET VERBOSITY TO
terse;" to either the first command or within the PL/pgSQL function
Said Ramirez wrote:
I think you are more after something like
SELECT CASE WHEN foo IS NULL THEN 'NA' END FROM bar.
-Said
An even simpler way to do this is using the COALESCE function:
http://www.postgresql.org/docs/current/interactive/functions-conditional.html
SELECT COALESCE(foo, 'NA') AS
Mike Toews wrote:
Keep in mind that you can't mix data types, like 'NaN'::text and
32.3::float in the result.
oh yeah, regarding mixing data types (in regards to the first post)...
A good exception is that you can use 'NaN' for floating point data
types, so:
SE
I'm using 8.3, and I'm trying to work with the interval type, and I
can't seem to get things right. I've been all over the docs[1,2], and
there is no mention on how this can be done.
While I can get:
SELECT '3 day 2 hour 34 minute'::interval
.. how can then get the fractional hours of this time i
On 30 March 2010 11:55, Tom Lane wrote:
> I think what Mike is actually looking for is
>
> SELECT extract(epoch from interval '3 days 2 hours 34 minutes');
> date_part
> ---
> 268440
Yet better, if I define 1 hour as 3600 seconds (this is only incorrect
if the interval spans over a le
13 matches
Mail list logo