[SQL] Efficient deletions?

2003-08-01 Thread Bertrand Petit
Hello, This is my first message to this list. I'm curently trying to improve my postgres skillsm I've assigned myself a project involving a database whose dataset is quite larger than those I had to use until now. I'm curently facing a trouble with the DELETE query: I ne

Re: [SQL] backend cpu usage? [7.2]

2003-08-01 Thread Tom Lane
george young <[EMAIL PROTECTED]> writes: > How can I get cpu usage info in 7.2 about the backend process of my db > connection? I tried looking at the pg_stat_get_backend_pid function > but it requires a backend_id that I don't know how to get. > If I can get the backend pid I can fork a 'ps' comm

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Bruce Momjian
Added. --- Josh Berkus wrote: > Bruce, > > > OK, so what should the TODO item be? > > Go with the simple and intuitive: > > EXECUTE query_var INTO record_var; > > -- > -Josh Berkus > Aglio Database Solutions > San Fra

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Josh Berkus
Bruce, > OK, so what should the TODO item be? Go with the simple and intuitive: EXECUTE query_var INTO record_var; -- -Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)--- TIP 9: the planner will ignore your desire to c

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Bruce Momjian
OK, so what should the TODO item be? --- Josh Berkus wrote: > Guys, > > > I'm not an Oracle bunny but they seem to have something vaguely similar > > to what we do; they call it "EXECUTE IMMEDIATE" and the concept is > > de

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Josh Berkus
Guys, > I'm not an Oracle bunny but they seem to have something vaguely similar > to what we do; they call it "EXECUTE IMMEDIATE" and the concept is > described as "Dynamic SQL". Aha. I see it now; a pretty awful OO-package-style format. I don't think we want to imitate this. -- -Josh Berku

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Richard Poole
On Fri, Aug 01, 2003 at 01:06:18PM -0700, Josh Berkus wrote: > As far as I can tell from my PL/SQL guide to Oracle8, PL/SQL does not permit > exectution of strings-as-queries at all. So there's no equivalent in PL/SQL. I'm not an Oracle bunny but they seem to have something vaguely similar to w

[SQL] backend cpu usage? [7.2]

2003-08-01 Thread george young
[postgresql-7.2, x86 linux] How can I get cpu usage info in 7.2 about the backend process of my db connection? I tried looking at the pg_stat_get_backend_pid function but it requires a backend_id that I don't know how to get. If I can get the backend pid I can fork a 'ps' command from my app, tho

Re: [SQL] NEW and a subselect in a rule

2003-08-01 Thread Denis Zaitsev
On Thu, Jul 31, 2003 at 10:00:07AM +0200, Christoph Haller wrote: > > > > So, I met such a problem: it's impossible to use NEW in a subselect > > used in a (non-select) rule. The error is: > > exist>. Is this a way to do that newertheless (without using of a > > function, of course)? > > > Coul

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Josh Berkus
Robert, > I don't seem to have any plsql specfic documentation, and the rest of my > oracle documentation isn't specfific enough. Anyone else? As far as I can tell from my PL/SQL guide to Oracle8, PL/SQL does not permit exectution of strings-as-queries at all. So there's no equivalent in PL/SQ

Re: TODO item for plpgsql Was Re: [SQL] obtuse plpgsql function needs

2003-08-01 Thread Robert Treat
I don't seem to have any plsql specfic documentation, and the rest of my oracle documentation isn't specfific enough. Anyone else? Robert Treat On Thursday 31 July 2003 00:12, Bruce Momjian wrote: > Does Oracle have a syntax for this? > > -

Re: [SQL] What day is it - when it isn't NOW()?

2003-08-01 Thread tomg
On Fri, 1 Aug 2003, Josh Berkus wrote: > Thomas, > > > than now()? I'm looking for something along the lines of: > > SELECT to_char('2003-08-04', 'Day') without much success. > > > > Well, you could try the online docs under "Functions and operators" . Hey Josh, how goes...yeah I bumbled around

[SQL] What day is it - when it isn't NOW()?

2003-08-01 Thread tomg
Hi, SELECT to_char(now(), 'Day'); returns Friday as I'd hoped. But how do I return the day of the week for a specific date other than now()? I'm looking for something along the lines of: SELECT to_char('2003-08-04', 'Day') without much success. Can anyone point me to the right function/combinat

Re: [SQL] What day is it - when it isn't NOW()?

2003-08-01 Thread Josh Berkus
Thomas, > SELECT to_char(now(), 'Day'); returns Friday as I'd hoped. > But how do I return the day of the week for a specific date other > than now()? I'm looking for something along the lines of: > SELECT to_char('2003-08-04', 'Day') without much success. > > Can anyone point me to the right fu

Re: [SQL] What day is it - when it isn't NOW()?

2003-08-01 Thread Rod Taylor
'2003-08-04' is ambiguous. It could be a text string, a date, something else. So cast it. SELECT to_char('2003-08-04'::date, 'Day'); > SELECT to_char(now(), 'Day'); returns Friday as I'd hoped. > But how do I return the day of the week for a specific date other > than now()? I'm looking for s

Re: [SQL] Fwd: Bad Join moment - how is this happening?

2003-08-01 Thread Jamie Lawrence
Sorry to be slow on responses... Thanks to everyone who replies. On Wed, 30 Jul 2003, Richard Huxton wrote: > On Wednesday 30 July 2003 21:07, Jamie Lawrence wrote: > > I fully admit that I've been staring at this too long, and simply don't > > understand what is wrong. Apologies aside, any kin

Re: [SQL] duplicate dates

2003-08-01 Thread Christopher Browne
Jodi Kanter wrote: > I have one table that has a date/time field in it. I'd like to identify > the records in the database where the date/time fields are the same. How > can I do this? Do I need to create a view or temp table? Is there a way > to run through one table multiple times. If you

[SQL] duplicate dates

2003-08-01 Thread Jodi Kanter
Title: I have one table that has a date/time field in it. I'd like to identify the records in the database where the date/time fields are the same. How can I do this? Do I need to create a view or temp table? Is there a way to run through one table multiple times

Re: [SQL] converting interval to timestamp

2003-08-01 Thread Mike Rylander
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If the number of seconds between timestamps is acceptable then this is the solution I use: SELECT ABS(EXTRACT(EPOCH FROM t.field1) - EXTRACT(EPOCH FROM t.field2)) AS diff FROM table AS t; Adjust to your column and WHERE needs. One caveat: this o

Re: [SQL] length of recordset read through a cursor

2003-08-01 Thread Christoph Haller
> > After declaring a cursor, one way of obtaining the length of the resultset > is to perform a "MOVE 0" and read the PQcmdStatus which returns a "MOVE nn" > where nn is the length of the resultset. (A negative MOVE can then be used > to allow starting to fetch records from the beginning of the re