From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Brewer <fumanchu@aminus.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: SELECT '(1, nan, 3)'::cube;
Date: Tue, 15 Mar 2011 13:07:16 -0400
Message-ID: <432.1300208836@sss.pgh.pa.us> (raw)
In-Reply-To: <F1962646D3B64642B7C9A06068EE1E64110D759F@ex10.hostedexchange.local>
References: <F1962646D3B64642B7C9A06068EE1E64110D759F@ex10.hostedexchange.local>
"Robert Brewer" <fumanchu@aminus.org> writes:
> I'm working on a hypercube implementation in Postgres using contrib/cube
> and need to insert 80,000 rows in one go from Python. Doing so with
> INSERT, even multiple statements in one call, is pretty slow. I've been
> investigating if using COPY is faster. It is, but there's a problem:
> some of the cubes should include NaN. Writing:
> INSERT INTO foo (coords) VALUES (cube(ARRAY[1, 'nan', 3]::float[]));
> ...works fine. But I can't find the magic incantation to do the same
> thing using COPY FROM.
cube_in doesn't accept either 'nan' or 'inf'. It's probably a bug that
you can get those things into a cube value via cube(float8[]). Or we
could see about upgrading the datatype to allow them, but that would
require looking at all its operations not just cube_in. It seems pretty
likely to me that there are some other things in that module that won't
behave sanely with NaN, because the original author clearly never
thought about it.
I'd suggest rethinking your design to avoid needing NaN in a cube.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, fumanchu@aminus.org
Subject: Re: SELECT '(1, nan, 3)'::cube;
In-Reply-To: <432.1300208836@sss.pgh.pa.us>
References: <F1962646D3B64642B7C9A06068EE1E64110D759F@ex10.hostedexchange.local> <432.1300208836@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox