Re: [SQL] Rules aren't doing what I expect

2000-08-11 Thread Tom Lane
Mark Volpe <[EMAIL PROTECTED]> writes: > When I try this out, however, the rule seems to use the original > value, rather than the "corrected" value. Queries added by non-INSTEAD rules are always performed before the initially-given query, so you're right, the rule will see the unmodified value.

Re: [SQL] Problem with SQL query (eats swap)

2000-08-11 Thread Tom Lane
[EMAIL PROTECTED] (Mailing List Expander) writes: > select count(*) from attachments a where a.id in (select m.id from > mail m where m.date < now()-62); > but ran out of swap. The problem is that "now()-62" leaks memory to the tune of a few dozen bytes per evaluation. In existing releases that

Re: [SQL] Rules aren't doing what I expect

2000-08-11 Thread Mark Volpe
Tom Lane wrote: > > Queries added by non-INSTEAD rules are always performed before the > initially-given query, so you're right, the rule will see the unmodified > value. > > I'd suggest folding the log-entry-making into your trigger, actually. > If you have a trigger anyway then the insert into

[SQL] Trying to Creat a Rule

2000-08-11 Thread Madel, Kurt
Hello, I am trying to create a RULE that updates the size of a class when a student registers for that class and the register(module) table is updated, and subtract 1 from the given class size when a student drops a course. Actually, there is a class table and a module table. The class table's p

[SQL] [Fwd: I will be at Linux World]

2000-08-11 Thread Zot O'Connor
-- Zot O'Connor http://www.ZotConsulting.com http://www.WhiteKnightHackers.com I will be at Linux World in San Jose next week, Aug 15th, and 16th. This is a generic spam/post to see if anyone I know will be there, who wants to meet with me. I will also be in Atlanta the last week of Septemb

[SQL] non-cachable 'C' language functions

2000-08-11 Thread Forest Wilkinson
(using postgresql 6.5.2) I have created a set of postgres extension functions in C (which use SPI to perform queries), and added them to my database with something like this: CREATE FUNCTION my_next_uid(text) RETURNS text AS '/usr/lib/pgsql/my_uids.so' LANGUAGE 'c'; My functions are designed

[SQL] Week of the Year?

2000-08-11 Thread David Lloyd-Jones
I'm probably staring right at it. (One of the difficulties with RTFMing, is having too many docs!) Is there anything in the API that produces the week of the year, from 1 to 52 or 53 depending on the week of the year, and the days that are in that week? Many thanks.

Re: [SQL] non-cachable 'C' language functions

2000-08-11 Thread Tom Lane
Forest Wilkinson <[EMAIL PROTECTED]> writes: > Is my understanding correct? What should I do about it? The postgresql > 6.5.2 docs for CREATE FUNCTION don't tell me how to make my functions > non-cachable. 6.5 doesn't pay any attention to proiscachable, AFAIR. 7.0 does, but it defaults to assu

Re: [SQL] Week of the Year?

2000-08-11 Thread David Lloyd-Jones
Got it: -U with date. -dlj. - Original Message - From: "David Lloyd-Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 11, 2000 9:27 PM Subject: [SQL] Week of the Year? > I'm probably staring right at it. (One of the difficulties with RT

Re: [SQL] Week of the Year?

2000-08-11 Thread John McKown
Try using the function date_part such as: select date_part('week',now()); "and the days that are in that week" I guess want to answer a question such as: Given a date, what is first date in that same week, and what is the last date in that week. There are a couple of approaches to this. My firs

[SQL] Operator Precedence problem?

2000-08-11 Thread Philip Warner
I have a peculiar problem that I can't reproduce on a trivial database: select product, priority, count(*) as completed from issue where product = 'DIS' and create_date < '1-Aug-2000' and finish_date >= '1-Aug-2000' or finish_date is null group by product, priority; This produces a li