Re: [SQL] AutoCommit and DDL

2005-02-26 Thread Michael Fuhr
On Sat, Feb 26, 2005 at 02:56:52PM -0600, Don Drake wrote: > I turned AutoCommit on and re-ran the perl script and the tables get > created. Why won't these table's get created when AutoCommit is off? > Why do I have to commit DDL? If you're using DBI, are you using PrintError or RaiseError or

Re: [SQL] Reverse String in sql or pgplsql

2005-02-26 Thread Larry Rosenman
On Saturday 26 February 2005 11:55 am, Oisin Glynn wrote: > Did some searching on forums archives to no avail, I found a PL/Perl > example but would like to do this in plpgsql if possible. Does somebody > have this sitting around, I just dont want to reinvent the wheel. But if > need to I will. >

Re: [SQL] Reverse String in sql or pgplsql

2005-02-26 Thread Bradley Miller
create or replace function reverse_string(text) returns text as ' DECLARE reversed_string text; incoming alias for $1; BEGIN reversed_string = ; for i in reverse char_length(incoming)..1 loop reversed_string = reversed_string || substring(incoming from i for 1); end loop; return reverse

Re: [SQL] diference in dates in minutes

2005-02-26 Thread Joel Fradkin
You probably want to convert the dates to timestamps, subtract them to get an interval, extract the epoch to get timme in seconds and then divide by 60 to get time in minutes. The converting date to timestamp part isn't trivial. You need to decide on what you mean when you do this. If you really h

Re: [SQL] diference in dates in minutes

2005-02-26 Thread Bruno Wolff III
On Sat, Feb 26, 2005 at 15:14:02 -0500, Joel Fradkin <[EMAIL PROTECTED]> wrote: > You probably want to convert the dates to timestamps, subtract them to > get an interval, extract the epoch to get timme in seconds and then divide > by 60 to get time in minutes. > > The converting date to timesta

[SQL] AutoCommit and DDL

2005-02-26 Thread Don Drake
I have a generic function that creates partition tables and their corresponding indexes and constraints. I've tested the function using a GUI and it works great. We implemented in our data loaders (written in perl) and the DB connections have AutoCommit turned off. When we run it in the perl scr

[SQL] Reverse String in sql or pgplsql

2005-02-26 Thread Oisin Glynn
Did some searching on forums archives to no avail, I found a  PL/Perl example but would like to do this in plpgsql if possible. Does somebody have this sitting around, I just dont want to reinvent the wheel.  But if need to I will.   Thanks in advance,   Oisin

Re: [SQL] diference in dates in minutes

2005-02-26 Thread Bruno Wolff III
On Thu, Feb 24, 2005 at 17:34:08 -0500, Joel Fradkin <[EMAIL PROTECTED]> wrote: > Sorry for being redundant (I asked this a while back). > I was looking for in days before and used date math > Date1::date - date2::date returned the days which was fine for my original > question. > I did get a rep

Re: [SQL] Read count ?

2005-02-26 Thread Ragnar Hafstað
On Thu, 2005-02-24 at 17:17 +0200, Aarni Ruuhimäki wrote: > Hi, > > Could someone please give a hint on how to query the following neatly ? > > Get news from a news table that belong to a particular account, get segment > name from segments table for each news item and read count from read histo