[SQL] Error in declaring %rowtype for recurrence

2004-02-09 Thread Kumar
Dear Friends,   Postgres 7.3.4 on RH Linux 7.2   I am having an table name recurrence under the schema crm. While I refer it as %rowtype I have error msgs.   CREATE OR REPLACE FUNCTION crm.fn_rowtypetest() RETURNS varchar AS'DECLARE rec_recurrence crm.recurrences%rowtype;BEGINFOR rec_recurre

[SQL] Bug or Feature?

2004-02-09 Thread Herbert R. Ambos
Hey guys,   I found this interesting…     test=# create table t ( c char); CREATE TABLE   test =# \d t Table "public.t"  Column | Type | Modifiers +--+---  c  | character(1) |   test =# alter table t drop column c; ALTER TABLE

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Robert Creager
When grilled further on (Mon, 09 Feb 2004 13:49:17 +), Mark Gibson <[EMAIL PROTECTED]> confessed: > I probably didn't make this clear enough: > Nah. After re-reading your e-mail, I say what I missed the first time. 'Bout 1 hour before my normal thinking time... Cheers, Rob -- 20:20:54

Re: [SQL] techniques for manual ordering of data ?

2004-02-09 Thread scott.marlowe
On Sat, 7 Feb 2004, Peter Galbavy wrote: > I tried googling, but the keywords here are so general, that I couldn't find > much useful. > > I am looking for reommendations on how to build an ordered list of media (in > this case photographs) in a particular "context". What I have - which I have >

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Mark Gibson
Tom Lane wrote: Mark Gibson <[EMAIL PROTECTED]> writes: CREATE RULE bag_rel AS ON INSERT TO bag_test WHERE EXISTS (SELECT 1 FROM bag_test WHERE item = NEW.item) DO INSTEAD UPDATE bag_test SET qty = qty + NEW.qty WHERE item = NEW.item; This can't work because an ON INSERT r

Re: [SQL] Index not used - now me

2004-02-09 Thread Paul Thomas
On 09/02/2004 15:02 Christoph Haller wrote: [snip] Thanks for your reply so far, but there is one thing I still don't understand. You wrote It was disabling seqscan that was forcing an index scan to appear to be the least costly operation. Why appear? If the Index Scan has a Total runtime: 2.46 mse

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Mark Gibson
Richard Sydney-Smith wrote: Mark, love the idea, guess I should have read it somewhere but haven't. Obvious and beautiful. Please let me know if you or someone else solves the initial double value. I used to use functions for this kind of thing, and was thinking that what SQL really needed was

Re: [SQL] Index not used - now me

2004-02-09 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > You could also try lowering random_page_cost. Some people find as low as 1.2 > or so to be useful, but that would almost certainly be lying to postgres about > the costs of random access and would cause it to use index scans aggressively > even when they're

Re: [SQL] timestamptz - problems

2004-02-09 Thread Christopher Browne
Oops! [EMAIL PROTECTED] ("Mark Roberts") was seen spray-painting on a wall: > Hi im using 'timestamptz' in a function called: 'getdate' to enter > the start and finish time into a db field, however the date appears > to be inserted into the db in a random format, i wish for it to only > be entered

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Tom Lane
Mark Gibson <[EMAIL PROTECTED]> writes: > Alternatively, for the relative option (increase 'apple' by 12), replace > the 'bag_abs' rule with: > CREATE RULE bag_rel AS ON INSERT TO bag_test > WHERE > EXISTS (SELECT 1 FROM bag_test WHERE item = NEW.item) > DO INSTEAD > UPDATE

Re: [SQL] Index not used - now me

2004-02-09 Thread Greg Stark
Christoph Haller <[EMAIL PROTECTED]> writes: > Why appear? If the Index Scan has a Total runtime: 2.46 msec and the Seq Scan > a Total runtime: 46.19 msec, then the Index Scan is much faster. > Or am I completely off the track reading the explain analyze output? To estimate the relative costs

[SQL] timestamptz - problems

2004-02-09 Thread Mark Roberts
Hi im using 'timestamptz' in a function called: 'getdate' to enter the start and finish time into a db field, however the date appears to be inserted into the db in a random format, i wish for it to only be entered into the db as DD-MM- (European,UK). I understand this is probably a very simpl

Re: [SQL] Index not used - now me

2004-02-09 Thread Christoph Haller
> > > On 09/02/2004 12:50 Christoph Haller wrote: > > > > > \d Transfer_ModRange > >Table "public.transfer_modrange" > > Column | Type | Modifiers > > +--+--- > > module_pointer | smallint | not null > > from_module| smallint | not null > >

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Richard Sydney-Smith
Mark, love the idea, guess I should have read it somewhere but haven't. Obvious and beautiful. Please let me know if you or someone else solves the initial double value. Got me thinking of all the places I cold have used this instead of coding select/insert/update/delete. Also have you worked a s

Re: [SQL] Index not used - now me

2004-02-09 Thread Paul Thomas
On 09/02/2004 12:50 Christoph Haller wrote: I know there have been dozens of threads on this subject and I have searched the archives well (I hope at least), but still ... I have select version(); version -- Pos

Re: [SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Mark Gibson
Robert Creager wrote: When grilled further on (Mon, 09 Feb 2004 12:42:10 +), Mark Gibson <[EMAIL PROTECTED]> confessed: CREATE RULE bag_abs AS ON INSERT TO bag_test WHERE EXISTS (SELECT 1 FROM bag_test WHERE item = NEW.item) DO INSTEAD UPDATE bag_test SET qty = NEW.qty WHER

[SQL] Implementation of a bag pattern using rules

2004-02-09 Thread Mark Gibson
Hello, I've been playing around with a simple solution for a bag or sparse matrix using rules, but have encountered a few problems I wish to discuss. The bag pattern is commonly used for shopping baskets (item => quantity). This sollution can also be used for a sparse matrix too (row,col => val

[SQL] Disable/Enable Trigger?

2004-02-09 Thread Philippe Lang
Hello, How can I disable a trigger in a function, and then enable it again? I'm using PG 7.3.4. Do I have to delete it, and create it again? Thanks Philippe ---(end of broadcast)--- TIP 6: Have you searched our list archives? http: