Re: [GENERAL] Query problem - explicit casts

2000-07-19 Thread Tom Lane
"kurt miller" <[EMAIL PROTECTED]> writes: > Updating table A(fqhcdata) based on values in table B(chn_jmembrm0). > Query 1: (the most obvious solution) > update fqhcdata > set sbrno=( select distinct social_sec_no > from chn_jmembrm0 > where subscriber

Re: [GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Lars
It may be ugly, but it sure works! Here is my query: SELECT Date, interval(trunc(date_part('epoch', time)/1800) * 1800) AS HALFHOUR, SUM(Data) FROM Table GROUP BY Date, HALFHOUR; This seems to work great, and I don't see any performance hit either. Thanks, -Lars On Thu, 20 Jul 2000, Tom Lane w

Re: [GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Thomas Lockhart
> In the long run it seems like date_trunc ought to be more flexible > than it is... Now that we can easily overload built-in functions, we should be able to have an alternate form for date_trunc() which can do this. Say, by accepting a double value as the first argument, which would be the amoun

Re: [GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Tom Lane
Lars <[EMAIL PROTECTED]> writes: > What I would like to do though is aggregate by each half hour or maybe > even 20 minutes. Does anyone know a good way to do this? I don't have a *good* answer, but a brute-force way is * convert timestamp to integer seconds with date_part('epoch', foo) * round

Re: [HACKERS] Re: [GENERAL] PRIMARY KEY & INHERITANCE (fwd)

2000-07-19 Thread Chris Bitmead
Tom Lane wrote: > > Chris Bitmead <[EMAIL PROTECTED]> writes: > > ... The attnum and the name should > > probably be individual to each class in the hierarchy. (The name should > > be individual to support subclass renaming to avoid naming conflicts, > > like in the draft SQL3 and Eiffel). If it

[GENERAL] Aggregate time data on half hour interval

2000-07-19 Thread Lars
I am looking for a way to aggregate timestamped data on a half hour interval, not just by the hour or minute. Suppose I have a table composed of: Date | Time | Data ---+--+-- 1999-12-19 | 10:00:00 | 76 1999-12-19 | 10:15:00 | 72 1999-12-19 | 10:30:00 | 77 1999-12-19

Re: [HACKERS] Re: [GENERAL] PRIMARY KEY & INHERITANCE (fwd)

2000-07-19 Thread Tom Lane
Chris Bitmead <[EMAIL PROTECTED]> writes: > ... The attnum and the name should > probably be individual to each class in the hierarchy. (The name should > be individual to support subclass renaming to avoid naming conflicts, > like in the draft SQL3 and Eiffel). If it is in two parts then using th

Re: [GENERAL] unique constraint - bug?

2000-07-19 Thread Tom Lane
Merrill Oveson <[EMAIL PROTECTED]> writes: > It appears as though the null value inserted for column b causes an > abrogation of the unique constaint. Two nulls are never considered equal, therefore the unique constraint does not trigger. This is correct behavior according to SQL92 4.10.2:

RE: [GENERAL] unique constraint - bug?

2000-07-19 Thread Mikheev, Vadim
> unique (a, b, c) > ); > > insert into letter values('1','2','3'); > insert into letter values('1','2','3'); > > insert into letter (a,c) values ('1','3'); >

Re: [GENERAL] Does CREATE FUNCTION... WITH (ISCACHABLE) work?

2000-07-19 Thread Tom Lane
"Joel Burton" <[EMAIL PROTECTED]> writes: >> If foo() is marked cachable then it's evaluated once during query >> planning; if not it's evaluated again for each row scanned in table1. > Sounds reasonable. But does it work as advertised? Yes, it does. You're still not trying it on multiple tuple

Re: [HACKERS] Re: [GENERAL] PRIMARY KEY & INHERITANCE (fwd)

2000-07-19 Thread Chris Bitmead
Stephan Szabo wrote: > > Of course I had to be half asleep when I wrote the second paragraph of my > response, since I totally missed he was using a serial. The rest still > applies though... > > As an aside to Chris, what interactions do you expect between the OO stuff > you've been working on

Re: [GENERAL] Does CREATE FUNCTION... WITH (ISCACHABLE) work?

2000-07-19 Thread Joel Burton
On 19 Jul 2000, at 14:30, Tom Lane wrote: > "Joel Burton" <[EMAIL PROTECTED]> writes: > > I have a function that always returns the same answer given the same > > input (no database lookups, etc.). The pg Users' Manual documents > > the attribute 'iscachable' as allowing the database to parse t

[GENERAL] unique constraint - bug?

2000-07-19 Thread Merrill Oveson
All: Run the following script: drop table letter; create table letter ( a char(1), b char(1), c char(1), unique (a, b, c)

[GENERAL] Retrieving images from PG using Java

2000-07-19 Thread Swaminathan R. Iyer
Hi, I have problems retrieving an image from postgresql database using Java, though I can insert one into it. I would appreciate if you can email me some code snippet that does the trick or you can point me to some URL that would help me with the same. Thanks. Swami

Re: [GENERAL] Does CREATE FUNCTION... WITH (ISCACHABLE) work?

2000-07-19 Thread Tom Lane
"Joel Burton" <[EMAIL PROTECTED]> writes: > I have a function that always returns the same answer given the > same input (no database lookups, etc.). The pg Users' Manual > documents the attribute 'iscachable' as allowing the database to > parse the results of the function and not keep looking

[GENERAL] Query problem - explicit casts

2000-07-19 Thread kurt miller
Query problems. Updating table A(fqhcdata) based on values in table B(chn_jmembrm0). Keys: Table A: sbrno - char(15) Table B: subscriber_number - varchar *both fields have indexes == Query 1: (the most obvious solution)

[GENERAL] Does CREATE FUNCTION... WITH (ISCACHABLE) work?

2000-07-19 Thread Joel Burton
I have a function that always returns the same answer given the same input (no database lookups, etc.). The pg Users' Manual documents the attribute 'iscachable' as allowing the database to parse the results of the function and not keep looking it up. Does this actually work yet? A simple test

Re: [GENERAL] tcl/tk interface on Digital Unix

2000-07-19 Thread Tom Lane
Peter Mittermayer <[EMAIL PROTECTED]> writes: >> When I try to run the configure script with the option --with-tcl, >> the tclConfig.sh is not found because it simply does not exits on >> a Digital Unix machine! But the Tcl/Tk package is installed on the >> machine (obviously without these scripts

Re: [HACKERS] Re: [GENERAL] PRIMARY KEY & INHERITANCE (fwd)

2000-07-19 Thread Stephan Szabo
Of course I had to be half asleep when I wrote the second paragraph of my response, since I totally missed he was using a serial. The rest still applies though... As an aside to Chris, what interactions do you expect between the OO stuff you've been working on and foreign key references? I'm

Re: [GENERAL] Postgres + PHP question: username in pg_connect?

2000-07-19 Thread Andrew Sullivan
On Tue, Jul 18, 2000 at 04:51:09PM -0700, Erich wrote: > > I'm getting ready to switch over from MySQL to Postgres for my PHP > application. Looking over the docs of PHP, it shows a pg_connect > command, which doesn't accept a user name. Any ideas on how to get it > to connect with a specified

[GENERAL] Re: [HACKERS] Re: pg_dump with BLOBS & V7.0.2 UPDATED

2000-07-19 Thread Pavel Janík ml.
From: [EMAIL PROTECTED] (Pavel Janík ml.) Date: Wed, 19 Jul 2000 11:11:05 +0200 Hi, > this patch applied, just untar the newest snapshot to src/bin/pg_dump > and you can continue with normal installation: configure && make && > make install. hmm. PG_VERSION is defined as 0 in ver

[GENERAL] Re: pg_dump with BLOBS & V7.0.2 UPDATED

2000-07-19 Thread Pavel Janík ml.
From: Philip Warner <[EMAIL PROTECTED]> Date: Sun, 16 Jul 2000 20:49:35 +1000 Hi Philip, > Another update of the dump code; this fixes a few bugs that people without > zlib under 7.02 would have experienced. Also, if you wish to use zlib, you > need to modify the Makefile to add -

Re: [GENERAL] order by rand()

2000-07-19 Thread Steve Heaven
At 23:46 18/07/00 +0200, Peter Eisentraut wrote: >Mike Sears writes: > >> I'm wondering if postgress is able to do order by rand() or if it is done by >> some other means through php easily > >The function is called random(), but yes, it works. > Is this a 7.x only feature ? With 6.5.2 I get sel