Re: [SQL] "Flattening" query result into columns

2005-03-23 Thread Tambet Matiisen
The problem in linked article could be solved with custom aggregate in PostgreSQL: create or replace function concat(text, text) returns text immutable language sql as ' select case when $1 = then $2 else $1 || '' '' || $2 end '; drop aggregate concat(text) cascade; create aggregate c

Re: [SQL] Self-referencing table question

2005-03-23 Thread Sean Davis
On Mar 22, 2005, at 7:07 PM, Sean Davis wrote: - Original Message - From: "Richard Huxton" To: "Sean Davis" <[EMAIL PROTECTED]> Cc: "PostgreSQL SQL" Sent: Tuesday, March 22, 2005 3:59 PM Subject: Re: [SQL] Self-referencing table question Sean Davis wrote: I answer my own question, if onl

[SQL] How do I do this?

2005-03-23 Thread Wei Weng
I have a table with column filepath with contents that look like the following: filepath == /var/log/foo /var/log/bar /var/cache/foo /var/cache/bar /var/foo /var/bar Is there anyway to retrieve the directory information only regarding those filepaths? So that I can get /var/log /var/c

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Gary Stainburn
On Friday 18 March 2005 7:54 pm, you wrote: > > My question is what's the best way to swap settings between the two > > computer records and swap any software installed? Ideally I'd like > > it in the form of a function where I can pass the two p_id's and > > return a boolean reflecting success (t

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Gary Stainburn
On Friday 18 March 2005 4:32 pm, you wrote: > How about a user defined function ??? > > CREATE OR REPLACE FUNCTION harwareupdate(integer, integer) RETURNS > BOOLEAN AS ' > > update pieces set p_name = \'LSALES1\', p_location = \'Mike > Haley\', p_site = \'L\' where p_id = $1; > > update pie

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Michael Long
> On Friday 18 March 2005 4:32 pm, you wrote: >> How about a user defined function ??? >> >> CREATE OR REPLACE FUNCTION harwareupdate(integer, integer) RETURNS >> BOOLEAN AS ' >> >> update pieces set p_name = \'LSALES1\', p_location = \'Mike >> Haley\', p_site = \'L\' where p_id = $1; >> >>

Re: [despammed] [SQL] How do I do this?

2005-03-23 Thread Andreas Kretschmer
am 23.03.2005, um 12:37:54 -0500 mailte Wei Weng folgendes: > I have a table with column filepath with contents that look like the > following: > > filepath > == > /var/log/foo > /var/log/bar > /var/cache/foo > /var/cache/bar > /var/foo > /var/bar > > Is there anyway to retrieve the

Re: [SQL] view function on pg_toast

2005-03-23 Thread bandeng
to Michael, We use pg manager from EMS and misstype. it should be created on public but on pg_toast On Wed, 23 Mar 2005 10:09:19 +0500, Mihail Nasedkin <[EMAIL PROTECTED]> wrote: > MN> March, 23 2005, 8:39:31: > > b>> hello guys, > > b>> I need help. I have functions but it is saved to pg_toa

Re: [SQL] best way to swap two records (computer details)

2005-03-23 Thread Gary Stainburn
On Wednesday 23 March 2005 5:26 pm, you wrote: > On Friday 18 March 2005 7:54 pm, you wrote: > > > My question is what's the best way to swap settings between the > > > two computer records and swap any software installed? Ideally > > > I'd like it in the form of a function where I can pass the tw

Re: [SQL] How do I do this?

2005-03-23 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > I have a table with column filepath with contents that look like the > following: .. > Is there anyway to retrieve the directory information only regarding those > filepaths? SELECT rtrim(substring(filepath from '.+/'),'/') FROM mytable; - -- Gr