[SQL] fmgr_info: function 15238119: cache lookup failed

2003-11-19 Thread Iain
(B (B (BHi All, (B  (BI have a problem with a before update (Btrigger that I was wondering if someone might be able to give me some help (Bwith. (B  (BDB version is 7.2. Here is a cut down (Bversion of an already simple trigger and function that is returning the (Berror: (B  (B   

Re: [SQL] fmgr_info: function 15238119: cache lookup failed

2003-11-19 Thread Iain
- (B From: (B Iain (B To: [EMAIL PROTECTED] (B Sent: Thursday, November 20, 2003 (B 11:37 AM (B Subject: fmgr_info: function (B 15238119: cache lookup failed (B (B Hi All, (B   (B I have a problem with a before update (B trigger that I was wondering if someone

Re: [SQL] Bug: Sequence generator insert

2003-11-30 Thread Iain
Hi Colin, You have done a nice job of demonstrating the documented behaviour of sequences. Sequences are designed for speed and high concurrency. They do not guarantee contiguous numbers and are not included in any transaction as I understand it. regards Iain - Original Message - From

Re: [SQL] Bug: Sequence generator insert

2003-11-30 Thread Iain
t value for the id (ir didn't use the default) but still used (and therefore incremented) the sequence. Regards Iain - Original Message - From: "Burr, Colin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 26, 2003 8:37 AM Subject: [SQL] B

Re: [SQL] Validity check in to_date?

2003-12-02 Thread Iain
ms that the problem only applies to checks. Now, I am wondering if there is a clever work around to this? It escapes me for now anyway. Regards Iain - Original Message - From: "Karel Zak" <[EMAIL PROTECTED]> To: "Christoph Haller" <[EMAIL PROTECTED]> Cc: &q

Re: [SQL] Validity check in to_date?

2003-12-02 Thread Iain
insert into test1 values ('2002/03/22'); insert into test1 values ('2002/03/32'); insert into test1 values ('200/03/22'); insert into test1 values ('2002/ 3/22'); insert into test1 values ('2002/03/2'); insert into test1 values ('2002/03/ 2'

Re: [SQL] migration between databases and versions

2003-12-17 Thread Iain
were added in a different order. It may be that using different dump options could get around this though - such as generating the dump as insert statements. If you come up wth any interesting information as you progress with this, I'd be happy to hear about it. Regards Iain - Original

Re: [SQL] how to preserve \n in select statement

2003-12-23 Thread Iain
much about Postgres' SQL cache, but it is well known in Oracle circles that using bind variables is is a critical part of system design, not just for security, but for performance and scalability. I suspect that the same issues apply more or less to postgres. Correct me if I'm wrong, ple

[SQL] not in vs not exists - vastly diferent performance

2003-12-24 Thread Iain
(B (B (BHi All, (B  (BI found this interesting and thought I'd (Boffer it up for comment. (B  (BI have the following delete: (B  (Bdelete from tableB where id not in (select (Bid from tableA); (B  (BThere are about 100,000 rows in table A, (Band about 500,000 in table B. id is ind

Re: [SQL] not in vs not exists - vastly diferent performance

2004-01-04 Thread Iain
Hi Tom, (B (B> You didn't say what PG version you are using, but I'd venture to bet (B> it is pre-7.4. (B (BSorry I didn't give the version number, here is the output from select (Bversion(): (B (BPostgreSQL 7.4 on i686-pc-linux-gnu, compiled by GCC 2.95.3 (B (BThis is the first time that

[SQL] name of a column returned from a table function

2004-01-19 Thread Iain
(B (B (BDB Version 7,4. (B  (BI had a look through the docs, but the (Binformation on table functions (those returning SETOF something) seems to have (Bgone missing from the 7.4 docs. I found something under 7.3, but it didn't (Banswer my question, which is... (B  (BI've written a lit

Re: [SQL] Slow sub-selects, max and count(*)

2004-02-04 Thread Iain
Hi,   I don't think thatyou gave enough information to get any direct help, for example, what are these "sub-selects"?   I often see performance problems arising from procedural code that puts selects that don't use indexes inside loops. That's a plain programming issue, and understanding yo

Re: [SQL] Indexes and statistics

2004-02-18 Thread Iain
, and for specific situations such as you mentioned. HTH Iain ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] How to get Rows Count

2004-02-29 Thread Iain
howabout: select sum(case when c = '*' then 0 else 1 end) as count_not_star from tablename If you want to process all records but only count thouse without a * in c then this will do the trick. regards iain - Original Message - From: "Abdul Wahab Dahalan" &l

Re: [SQL] ANALYZE error

2004-03-08 Thread Iain
ollecting information and trying to isolate the problem. It would be a good idea to give all the relevant version numbers too regards iain ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscr

Re: [SQL] Simple SQL question

2004-03-08 Thread Iain
f the select and test them using "ANALYSE SELECT ..." .I'm using 7.4.1. The result from the select is the same, even if you don't make an index on the function result.It's just a performance consideration. If the index isn't used, then you don't need to create

Re: [SQL] Simple SQL question

2004-03-08 Thread Iain
Sorry, did I write "ANALYSE SELECT "? It's supposed to be "EXPLAIN [ANALYSE] [VERBOSE] SELECT ..." - Original Message - From: "Daniel Henrique Alves Lima" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 1:21 PM Subject: Re: [SQL] Simple SQL question > Tha

Re: [SQL] randomized order in select?

2004-03-10 Thread Iain
If you have a lot of tips, you could create a unique indexed tip number column. Select the highest tip number using: select tip_number from tips order by tip_number desc limit 1; Then generate a random number and select using that tip_number. Of course, you would have to allow for the possibilit

Re: [SQL] feature request ?

2004-06-24 Thread Iain
> > IF foo IS NULL > > THEN ... > > ELSIF foo > > THEN ... > > ELSE ... > > END IF; > > here the foo expression woll be executed twice if you can use an immutable or stable function then the overhead would be minimal as the system knows that it doe

Re: [SQL] surrogate key or not?

2004-07-20 Thread Iain
Hi, (B (Bfor my 2c worth, performance is the least important of the things you need (Bto consider regarding use of surrogate keys. (B (BI use surrogate keys for all situations except the simplest code/description (Btables, and this is only when the code has no meaning to the application. If 

Re: [SQL] surrogate key or not?

2004-07-21 Thread Iain
r have happened anyway. (B (BThis is a great topic though, I find it really interesting. (B (BRegards (BIain (B (B (B (B (B- Original Message - (BFrom: "Josh Berkus" <[EMAIL PROTECTED]> (BTo: "Iain" <[EMAIL PROTECTED]>; "Markus Bertheau"

Re: [SQL] surrogate key or not?

2004-07-26 Thread Iain
ata (or quality data). On the whole, I think that there are more important indicators of quality (or lack of it) in your database design than the prevalence (or lack) of numeric ID style keys. Personally, I've grown to appreciate the id approach over the years, but my mind is always

Re: [SQL] surrogate key or not?

2004-07-26 Thread Iain
or new knowlege in their patients records, as applying the knowlege gained from research (done by researchers) to treat individual patients. Karsten might beg to differ, I don't know, but the "long flaky text" comment triggered some old (and fond) memories ;-) Ch

Re: [SQL] surrogate key or not?

2004-07-27 Thread Iain
intern or researcher, but I imagine it would be best to have the doctor do it at the time. Just some vague ideas anyway. This may of course be much more work than anyone wants to get into... I don't have much experience with text searching systems, but something reasonably sophistic

Re: [SQL] pg_dump/pg_restore question

2004-08-22 Thread Iain
some information is in the admin section and some is in the documentation of the client programs (pg_dump and pg_restore are client programs iirc). Also, consider upgrading to 7.4 to ensure you get the best support. Good luck, Iain - Original Message - From: "Worik" <[

Re: [SQL] Possible rounding error of large float values?

2004-08-24 Thread Iain
(B# select 9223372036854775807 = 9223372036854775807::float; (B ?column? (B-- (B t (B(1 row) (B (B# select 9223372036854775807 = 9223372036854775807.0::float; (B ?column? (B-- (B t (B(1 row) (B (B# select 9223372036854775807 = 9223372036854775807.::numeric; (B ?co

Re: [SQL] Possible rounding error of large float values?

2004-08-24 Thread Iain
, I can't remember last time I designed a database that used float data... regards Iain ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

[SQL] implementing an out-of-transaction trigger

2004-09-14 Thread Iain
(B (B (BHi All, (B  (BI've come across a situation where I'd (Blike to use some kind of "out-of-transaction trigger" to do some processing (Bafter changes to some tables, but without extending the duration of the main (Btransaction. Of course, it's important that the processing be compl

Re: [SQL] implementing an out-of-transaction trigger

2004-09-15 Thread Iain
e a client program to create a session and actually do the listening, that is if I havn't missed anything else... Thanks again, Iain - Original Message - From: "Mike Rylander" <[EMAIL PROTECTED]> To: "Iain" <[EMAIL PROTECTED]> Cc: <[EMAIL PROT

Re: [SQL] implementing an out-of-transaction trigger

2004-09-15 Thread Iain
name of the notification to determine what processing to activate. Thanks, Iain - Original Message - From: "Greg Stark" <[EMAIL PROTECTED]> To: "Iain" <[EMAIL PROTECTED]> Cc: "Mike Rylander" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sen

Re: [SQL] Reuse previously calculated column in sql query?

2004-10-20 Thread Iain
Using the the sub-select is one way, but there is another way. (B (BIf the function can be declared as strict or immutable the you can call it (Bas many times as you like in a single transaction and it will only be (Bevaluated once. As far as I know this does work as advertised. (B (BCheck

Re: [SQL] paertially restoring a DB

2004-10-31 Thread Iain
offending lines and restore using the --use-list option. If you used the custom format you have a lot of options for extracting individual table data and stuff like that. Good luck, Iain - Original Message - From: "Niall Linden" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>

Re: [SQL] get sequence value of insert command

2004-11-19 Thread Iain
I seem to recall it was mine. I made the mistake of assuming it wasn't concurrency safe and was gently corrected by one of the community. I think it might have been a Tim/Tam Lane. Wonder what happened to him? :-) M tim tams rgds Homer ---(end of broadcast)

[SQL] invalid 'having' clause

2004-12-01 Thread Iain
Hi, (B (BJust a quick question out of curiosity, I was just wondering if this is (Bsupposed to be valid sql: (B (Bselect count(*) as cnt (Bfrom sometable (Bgroup by somecolumn (Bhaving cnt > 1 (B (BThis isn't valid in pg (7.4.6), but this is: (B (Bselect count(*) (Bfrom sometable (Bg

Re: [SQL] invalid 'having' clause

2004-12-02 Thread Iain
OK, thanks. That seems to make sense. (B (Bregards (BIain (B- Original Message - (BFrom: "Tom Lane" <[EMAIL PROTECTED]> (BTo: "Iain" <[EMAIL PROTECTED]> (BCc: <[EMAIL PROTECTED]> (BSent: Thursday, December 02, 2004 11:54 AM (BSubject: Re:

Re: [SQL] Date datatype

2004-12-21 Thread Iain
or, # update table set birthdate = to_date('2000-01-01','-MM-DD'); I'm not sure which is better though I tend to do it this way. regards Iain - Original Message - From: "Achilleus Mantzios" <[EMAIL PROTECTED]> To: "Pablo Digonzelli&quo

Re: [SQL] I'm stumped

2004-12-21 Thread Iain
27;t you change the key in the emp table when that key represents the employee's department?". It seems like a handbook case to me but maybe I missed something. regards Iain I can't figure out an efficient way to do this. Basically I had a typical 3-tier relationship: (Employee ->

Re: [SQL]

2005-01-31 Thread Iain
hi,   I'm not familiar with iso2709  but there is a program called Octopus that may do what you want. It's open source software and can be found at octopus.enhydra.org - worth a try anyway.   Regards Iain - Original Message - From: Matteo Braidotti To:

Re: [SQL] pg primary key bug?

2005-02-17 Thread Iain
Hi Ivan,   Sorry, I can't remember all you said in earlier posts, but I was wondering, your log file says:   > HINT:  Rebuild the index with REINDEX. Did you do that, and did it solve the problem?   regards Iain - Original Message - From: pginfo To: Tom Lane Cc

[SQL] smart(er) column aliases

2003-10-14 Thread Iain Sinclair
(B (B (BHi all, (B  (BTo take a simple example here is what I (Bwanted to do: (B  (B   select 1 as one, 2 as two, (Bone + two as three; (B  (Bbut it doesn't work. I've checked it out (Bthough, and I found that I can do this: (B  (B   select one, two, one + two (Bfrom (select 1 a