Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-07 Thread Achilleas Mantzios
Στις Πέμπτη 08 Φεβρουάριος 2007 09:19, ο/η Bryce Nesbitt έγραψε: > Philip Hallstrom wrote: > >> I need to create some nearly identical copies of rows in a complicated > >> table. > >> > >> Is there a handy syntax that would let me copy a existing row, but get a > >> new primary key for the copy? I

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-07 Thread Bryce Nesbitt
Philip Hallstrom wrote: >> I need to create some nearly identical copies of rows in a complicated >> table. >> >> Is there a handy syntax that would let me copy a existing row, but get a >> new primary key for the copy? I'd then go in an edit the 1 or 2 >> additional columns that differ. The dupl

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-07 Thread Bryce Nesbitt
I have a table that describes some properties. It is logically equivalent to: pk userid favorite_color time_zone count 122100 red Pacific7 145101 blue Eastern 7 For various reasons I need to manually add a few r

Re: [SQL] question on passing parameter in sql query

2007-02-07 Thread Chad Wagner
On 2/7/07, Karthikeyan Sundaram <[EMAIL PROTECTED]> wrote: I don't want to compare with Oracle and postgres. But I have a situation. I am using psql command line tool supplied by postgres. In Oracle I can say select * from emp where emp_id = &1 Oracle will ask: Enter a value

[SQL] question on passing parameter in sql query

2007-02-07 Thread Karthikeyan Sundaram
Hi, I don't want to compare with Oracle and postgres. But I have a situation. I am using psql command line tool supplied by postgres. In Oracle I can say select * from emp where emp_id = &1 Oracle will ask: Enter a value for 1: If I enter 10, then Oracle will get the empid=10

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-07 Thread Philip Hallstrom
I need to create some nearly identical copies of rows in a complicated table. Is there a handy syntax that would let me copy a existing row, but get a new primary key for the copy? I'd then go in an edit the 1 or 2 additional columns that differ. The duplicate would be in the same table as the

[SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-07 Thread Greg Wittel
Hi, I've tried this on 8.2.1, .2 and .3: I'm having a strange problem with a PL/PGSQL query that executes some dynamic SQL code. The code basically creates a dynamically named table, some indexes, etc. The problem seems to be the an index expression. If I remove it and do a plain index on

[SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-07 Thread Bryce Nesbitt
I need to create some nearly identical copies of rows in a complicated table. Is there a handy syntax that would let me copy a existing row, but get a new primary key for the copy? I'd then go in an edit the 1 or 2 additional columns that differ. The duplicate would be in the same table as the o

Re: [SQL] interval as hours or minutes ?

2007-02-07 Thread Jan Muszynski
On 7 Feb 2007 at 19:03, Aarni Ruuhimäki wrote: > Hi all, > > Could anyone please tell an easy way to get total hours or minutes from an > interval ? > > SELECT SUM(stop_date_time - start_date_time) AS tot_time FROM work_times WHERE > user_id = 1; > tot_time > - > 2 days 14:08:

Re: [SQL] interval as hours or minutes ?

2007-02-07 Thread Bruno Wolff III
On Wed, Feb 07, 2007 at 19:03:35 +0200, Aarni Ruuhimäki <[EMAIL PROTECTED]> wrote: > > Could anyone please tell an easy way to get total hours or minutes from an > interval ? Extract the epoch from the interval and divide by the number of seconds in the period of time that applies and apply ap

Re: [SQL] metaphone and nysiis in postgres

2007-02-07 Thread Demel, Jeff
Can this be installed easily on Windows? -Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Demel, Jeff Sent: Wednesday, February 07, 2007 2:13 PM To: pgsql-sql@postgresql.org Subject: Re: [SQL] metaphone and nysiis in postgres Ah! Cool. Contrib/fu

Re: [SQL] metaphone and nysiis in postgres

2007-02-07 Thread Demel, Jeff
Ah! Cool. Contrib/fuzzystrmatch has metaphone. Looks like it has soundex and levenschtein too. Thanks! -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 07, 2007 2:09 PM To: Demel, Jeff Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] metaphone and

Re: [SQL] metaphone and nysiis in postgres

2007-02-07 Thread Tom Lane
"Demel, Jeff" <[EMAIL PROTECTED]> writes: > Microsoft SQL server has two extended stored procedures that I need in > Postgres: xp_nysiis and xp_metaphone. They do fuzzy matching on > strings. Are there Postgres alternatives for these? Never heard of nysiis, but there's metaphone code in contrib/

[SQL] metaphone and nysiis in postgres

2007-02-07 Thread Demel, Jeff
Microsoft SQL server has two extended stored procedures that I need in Postgres: xp_nysiis and xp_metaphone. They do fuzzy matching on strings. Are there Postgres alternatives for these? Or maybe some other way to do phonetic/fuzzy matching that would be as effective? -Jeff -Original M

Re: [SQL] interval as hours or minutes ?

2007-02-07 Thread A. Kretschmer
am Wed, dem 07.02.2007, um 19:03:35 +0200 mailte Aarni Ruuhimäki folgendes: > Hi all, > > Could anyone please tell an easy way to get total hours or minutes from an > interval ? > > SELECT SUM(stop_date_time - start_date_time) AS tot_time FROM work_times > WHERE > user_id = 1; Perhaps. You c

Re: [SQL] interval as hours or minutes ?

2007-02-07 Thread Bricklen Anderson
Aarni Ruuhimäki wrote: Hi all, Could anyone please tell an easy way to get total hours or minutes from an interval ? SELECT SUM(stop_date_time - start_date_time) AS tot_time FROM work_times WHERE user_id = 1; tot_time - 2 days 14:08:44 I'd like to have this like ... AS

[SQL] interval as hours or minutes ?

2007-02-07 Thread Aarni Ruuhimäki
Hi all, Could anyone please tell an easy way to get total hours or minutes from an interval ? SELECT SUM(stop_date_time - start_date_time) AS tot_time FROM work_times WHERE user_id = 1; tot_time - 2 days 14:08:44 I'd like to have this like ... AS tot_hours ... tot_hour