Re: [HACKERS] timestamp subtraction (was Re: [SQL] formatting intervals

2006-10-06 Thread Graham Davis
Great, it's nice to see that this might get rolled into one of the next releases. Thanks, Graham. Tom Lane wrote: Michael Glaesemann <[EMAIL PROTECTED]> writes: Considering how late it is in the cycle, perhaps the change in behavior should come in 8.3. Yeah, there&#

Re: [SQL] formatting intervals with to_char

2006-10-04 Thread Graham Davis
ows a better/proper way to get this result, let me know. Thanks, Graham. Graham Davis wrote: Hi, I'm trying to format the output of a time interval so that it displays as HH:MM:SS no matter how many days it spans. So for instance, an interval of 2 days 4 hours and 0 minutes w

[SQL] formatting intervals with to_char

2006-10-03 Thread Graham Davis
1 09:30:41'::timestamp), 'HH24:MI:SS'); Result: 14:28:19 It just gives me the offset of hours, min, seconds on that 14th day. The result I'm looking for is: 350:28:19 What am I doing wrong, or how can I get this desired output? Thanks, -- Graham Davis Re

Re: [SQL] Copy user privileges

2005-07-13 Thread Graham Vickrage
about the internals to attempt it. Thanks again, Graham -Original Message- From: Michael Fuhr [mailto:[EMAIL PROTECTED] Sent: 12 July 2005 20:29 To: Tom Lane Cc: Graham Vickrage; pgsql-sql@postgresql.org Subject: Re: [SQL] Copy user privileges On Tue, Jul 12, 2005 at 03:12:50PM -0400, Tom

[SQL] Copy user privileges

2005-07-12 Thread Graham Vickrage
Hi All, I have dumped a database with no data and restored it with a new db name. I want to keep all the privileges but assign them to a new user. What is the best way of doing this? Is it to alter the system tables directly in which case which ones. TIA, Graham

[SQL] Scheme not dropping

2005-03-15 Thread Graham Vickrage
I am dropping a database with an additional scheme other than public on version 7.3.2. When I come to recreate the database with the same scheme it gives me the error: ERROR: namespace "xxx" already exists Is this temp table issue, if so how do I get round it? Many thanks in advanc

Re: [SQL] Normalising an existing table - how?

2004-06-25 Thread Graham Leggett
e already exists. Regards, Graham -- ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html

Re: [SQL] Normalising an existing table - how?

2004-06-24 Thread Graham Leggett
part, does NewTable have to be empty first, or can it already exist? In my case NewTable has some rows in it already, as the database is currently partially normalised - I need to finish the job. Regards, Graham -- ---(end of broadcast)--- TIP 1

Re: [SQL] Normalising an existing table - how?

2004-06-24 Thread Graham Leggett
partially normalised database. Regards, Graham -- ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

[SQL] Normalising an existing table - how?

2004-06-24 Thread Graham Leggett
- can anyone suggest a query that might achieve the writing back of the primary key to the original table? Regards, Graham -- ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs

[SQL] Conversion question

2003-11-19 Thread Graham Vickrage
Apologies as this probably isn't really for this list but... In postgresql you can execute a statement such as: SELECT 1 > 2; And it would return 'f' Does anyone know if you can do this in SQL Server as I have to do a conversion of some prewritten SQL co

[SQL] Conversion Problem

2003-11-13 Thread Graham
Apologies as this probably isn't really for this list but... In postgresql you can execute a statement such as: SELECT 1 > 2; And it would return 'f' Does anyone know if you can do this in SQL Server as I have to do a conversion of some prewritten SQL co

[SQL] How do I view triggers

2003-02-21 Thread Graham Vickrage
Hi All, I am slightly confused as to how I view what triggers I have on a certain table. select * from pg_trigger doesn't show me the trigger I have just created, but its definitely there because when I try and create it, it gives an error that it already exists. TIA G

[SQL] pg_func problem

2003-02-20 Thread Graham Vickrage
RAISE EXCEPTION ''Invalid change of status, some of the order has already been entered into stock''; END IF; END IF; ELSIF (OLD.status = ''VOID'') AND NEW.status = ''Compl

[SQL] Re: Adding an INTERVAL to a variable

2001-08-09 Thread Graham Coates
Thanks for the inspiration Vivek! Didn't quite work, but when I made it... dSalesHdrDateDue + (iAcctPayDaysAv || 'Days')::INTERVAL BINGO! it works. Happiness is :-) Graham Coates "Vivek Khera" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]"&g

[SQL] Group by date_part

2001-07-10 Thread Graham Vickrage
Hi, I need to select the amount of orders per day from an order table. The statement I have only selects the count if there is at least 1 order for a particular day, which make sense. I however need a count of 0 for days that don't have any. Can anyone help? SQL: SELECT date_part('day', date)

[SQL] Strategy for unlocking query

2001-04-04 Thread Graham Vickrage
of dealing with this problem as I ended up stopping and restarting the postmaster? Also are functions within functions dealt with in a 'transactional' sense? Cheers Graham winmail.dat ---(end of broadcast)--- TIP 6: Have you searche

[SQL] Update taking forever

2001-03-29 Thread Graham Vickrage
ics (cost=0.00..56174.49 rows=14976 width=88) Would anyone be able to tell me why it is seemingly infinite, i'm running linux, postgres v7.0 Cheers Graham winmail.dat ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] Killing Postmaster

2001-03-28 Thread Graham Vickrage
Hi All, What is the correct way of killing postgres 7.0 on redhat linux. Is there a reason why vacuum hangs on a DB with about 1.5 million rows? Cheers Graham winmail.dat ---(end of broadcast)--- TIP 6: Have you searched our list archives

[SQL] grouping by date increments

2001-01-23 Thread Graham Vickrage
that as its doing a seqential scan then it may be possible to do it all at once. Has anyone done anything similar that or maybe could recommend a more efficient solution. Thanks Graham current select: SELECT to_char(timestamp('01-Jun-2000'), 'DD-Mon-'), to_char(timestamp

[SQL] psql -f option

2001-01-04 Thread Graham Vickrage
wever give me the associated line number in the script. This would be a very useful feature for me as my scripts can be very long. Is there a configuration option i am missing? Thanx in advance Graham winmail.dat

[SQL] Use of indexes in plpgsql functions

2000-12-15 Thread Graham Vickrage
it takes about 2.5 mins, Has > anyone had any similar problems/solutions or is it just that I am over > looking something??? (I know there is an update but again when executed > seperately it takes approx 1 sec) > > Regards > > Graham > > details as follows: - > >

[SQL] Trigger cant find function

2000-11-14 Thread Graham Vickrage
ERROR: CreateTrigger: function get_prod_cost_price() does not exist It is clear that it does exist so why does the trigger creation code not find it? Thanks in advance for any pointers. Graham

[SQL] Return from stored procedures

2000-11-10 Thread Graham Vickrage
Probably a very simple question, but how do you define a function that returns the sucess of an insert or update in a function i.e. CREATE FUNCTION foo ( varchar, int8 ) RETURNS bool AS 'UPDATE table WHERE something' LANGUAGE 'sql'; Cheers Graham

RE: [SQL] Null function parameters

2000-08-23 Thread Graham Vickrage
uture releases? Regards Graham -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Anatoly K. Lasareff Sent: 23 August 2000 12:46 To: Tom Lane Cc: Graham Vickrage; postgresql Subject: Re: [SQL] Null function parameters >>>>> "TL"

RE: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Graham Vickrage
As far as i know, you can only return single values from functions at the moment. Regards Graham -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of hlefebvre Sent: 23 August 2000 11:08 To: [EMAIL PROTECTED] Subject: [SQL] Using SETOF in plpgsql function

[SQL] Null function parameters

2000-08-22 Thread Graham Vickrage
understanding was that if the default value is SQL NULL then any values passed into the function that are null would be treated as 'NULL'. This doesn't seem to be the case. Chances are I am overlooking something, could any one point me in the right direction? Cheers Graham

RE: [SQL] sequences in functions

2000-08-18 Thread Graham Vickrage
done as two seperate calls in my perl scripts? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Yury Don Sent: 18 August 2000 15:07 To: [EMAIL PROTECTED] Subject: Re: [SQL] sequences in functions Hello Graham, Friday, August 18, 2000, 6:24:15 PM, you

[SQL] sequences in functions

2000-08-18 Thread Graham Vickrage
5, $6, id); RETURN id; END; ' LANGUAGE 'plpgsql'; And the error message is ERROR: parser: parse error at or near "client_seq" EOF Is this because of the ' ' ??? Also can you pass in a array or hash to the function? Cheers Graham

[SQL] pg_dump problem

2000-06-26 Thread Graham Vickrage
error message "query buffer max length of 16384 exceeded" after each row. Would somebody please tell me how to increse this buffer (assuming this is whats required to solve the problem) as I have looked though the documentation and I am still struggling :-( Cheers Graham