[SQL] connectby questions

2002-11-21 Thread Dan Langille
I just installed 7.3rc1 and added contrib/tablefunc. I am able to get the example in the README document to work. I am having trouble understanding how to get my real data to behave. The table is: freshports=# \d element Table "public.element" Column

[SQL] Dropping Ref. Integrity

2002-11-21 Thread Rudi Starcevic
Hi, I'm trying to drop some referential integrity on a table and am getting this error: PostgreSQL said: ERROR: zero-length delimited identifier Your query: DROP TRIGGER "RI_ConstraintTrigger_6187534" ON "host_domain"; DROP TRIGGER "RI_ConstraintTrigger_6187538" ON "host_domain"; DROP TRIGGER "

Re: [SQL] psql on FreeBSD 4.7-RELEASE-p2 and greek (iso8859-7) chars

2002-11-21 Thread Manuel Sugawara
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > Hi, > > I noticed that psql on FreeBSD (i checked also fbsd 4.5 with pgsql port > installed) > does not accept 8bit iso8859-* chars > 128 (where the greek chars are). > > In linux that works ok, and i can update/insert/select values > using greek

Re: [SQL] [HACKERS] [GENERAL] Bug with sequence

2002-11-21 Thread Rod Taylor
On Thu, 2002-11-21 at 15:09, scott.marlowe wrote: > On 21 Nov 2002, Rod Taylor wrote: > > > On Thu, 2002-11-21 at 14:11, Bruce Momjian wrote: > > > Of course, those would be SQL purists who _don't_ understand > > > concurrency issues. ;-) > > > > Or they're the kind that locks the entire table f

Re: [SQL] [HACKERS] [GENERAL] Bug with sequence

2002-11-21 Thread Tom Lane
"Thomas O'Connell" <[EMAIL PROTECTED]> writes: > It seems worth pointing out, too, that some SQL purists propose not > relying on product-specific methods of auto-incrementing. > I.e., it is possible to do something like: > insert into foo( col, ... ) > values( coalesce( ( select max( col ) from f

Re: [SQL] [HACKERS] [GENERAL] Bug with sequence

2002-11-21 Thread Bruce Momjian
Of course, those would be SQL purists who _don't_ understand concurrency issues. ;-) --- Thomas O'Connell wrote: > It seems worth pointing out, too, that some SQL purists propose not > relying on product-specific methods o

Re: [SQL] [GENERAL] Bug with sequence

2002-11-21 Thread Thomas O'Connell
It seems worth pointing out, too, that some SQL purists propose not relying on product-specific methods of auto-incrementing. I.e., it is possible to do something like: insert into foo( col, ... ) values( coalesce( ( select max( col ) from foo ), 0 ) + 1, ... ); and this is easily placed in a t

Re: [SQL] help optimise this ?

2002-11-21 Thread Peter Galbavy
Wow. Three people have replied with an effectively identical solution. Why didn't I think of this ? Answers on a postcard to... Thanks to all that have replied. Peter - Original Message - From: "Tom Lane" <[EMAIL PROTECTED]> To: "Peter Galbavy" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>

Re: [SQL] help optimise this ?

2002-11-21 Thread Tom Lane
"Peter Galbavy" <[EMAIL PROTECTED]> writes: > I want to then find either the largest (max) or smallest (min) version of an > image that falls within some range of sizes: Depends on how you want to define "largest" and "smallest", but if "area" is a good enough definition, seems like this would wor

Re: [SQL] Date trunc in UTC

2002-11-21 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Hmm - good point. You can revert to the client default but not to the > previous value. I don't know of any way to read these SET values > either - a quick poke through pg_proc didn't show anything likely. In 7.3 you can use current_setting() and set_co

Re: [SQL] help optimise this ?

2002-11-21 Thread Henshall, Stuart - Design & Print
Title: RE: [SQL] help optimise this ? Peter Galbavy wrote: > I have a table of image 'instances' where the columns include: > > md5 char(32),    -- the 'original' image md5 key > file_md5 char(32) primary key,   -- the md5 of each version of an > image image_width int, > image

Re: [SQL] why the difference?

2002-11-21 Thread Tom Lane
Jakub Ouhrabka <[EMAIL PROTECTED]> writes: > the where clause is evaluated before the distinct clause, so your queries > aren't equivalent because you switched the order by splitting the query > into two queries... Besides which, SELECT DISTINCT ON is order-sensitive. If you don't use an ORDER BY

[SQL] help optimise this ?

2002-11-21 Thread Peter Galbavy
I have a table of image 'instances' where the columns include: md5 char(32),-- the 'original' image md5 key file_md5 char(32) primary key, -- the md5 of each version of an image image_width int, image_length int I want to then find either the largest (max) or smallest (min)

[SQL] psql on FreeBSD 4.7-RELEASE-p2 and greek (iso8859-7) chars

2002-11-21 Thread Achilleus Mantzios
Hi, I noticed that psql on FreeBSD (i checked also fbsd 4.5 with pgsql port installed) does not accept 8bit iso8859-* chars > 128 (where the greek chars are). In linux that works ok, and i can update/insert/select values using greek strings. I know it must be a fbsd/locale issue, but it would b

Re: [SQL] importing a 7.2 db with contrib/tsearch to 7.3

2002-11-21 Thread Achilleus Mantzios
Thats what i do for intarray: -Install all contrib packages you want to use (*before* restoring your DB) -Restore Your DB -Look in log for errors -Correct them. Normally all you shoud get is a bunch of notices that somethings are allready defined. I had the same problem as you with gist indexes

Re: [SQL] Drop NOT NULL constraint !!!

2002-11-21 Thread Ludwig Lim
--- [EMAIL PROTECTED] wrote: > > do a \d tablename > > for the name of the contraint. > say its $1 > the do > > psql> alter table drop contstraint "$1" > RESTRICT; > I alter a table with by adding a foriegn key constraint. ALTER TABLE sc_city ADD CONSTRAINT cons_fkey FOREIGN KEY state_c

[SQL] importing a 7.2 db with contrib/tsearch to 7.3

2002-11-21 Thread Andreas Joseph Krogh
If this is the wrong list, please redirect me to the correct one. I have a PostgreSQL-7.2 installation with several databases in it which uses the contrib/tsearch module. I've done a (on 7.2): pg_dumpall and (on 7.3): /usr/local/pgsql/bin/psql -d template1 -f prod2-pg7.2.dmp I get a bunch of th

Re: [SQL] Date trunc in UTC

2002-11-21 Thread Richard Huxton
On Wednesday 20 Nov 2002 3:40 pm, Juan Fernandez wrote: > Hi Richard > > Ok, I'll do my best to explain clearer ;) I'll do my best to be of some use ;-) > I have to make some monthly reports about some service requests > activity. So, I'm keeping in a table the monthly traffic. > > TABLE traffic

Re: [SQL] why the difference?

2002-11-21 Thread Jakub Ouhrabka
hi, the where clause is evaluated before the distinct clause, so your queries aren't equivalent because you switched the order by splitting the query into two queries... so to obtain same results do create table as select ... where category_id=781 and then select distinct on () ... hth, kuba