Re: [SQL] is there a debian package for plperl?

2000-11-29 Thread Oliver Elphick

Bruno Boettcher wrote:
  >Hello,
  >subject says it all, wanted to give plperl a try, but the lib doesn't
  >seem installed... now i installed all through debian packaging system,
  >and the lib surely is somewhere, but i didn't found it yet...
  >
  >so i anybody could point on on where to search for it...

plperl failed to build in 7.0.2; however, I have just built 7.0.3-1 and plperl.so
is now included again.  This should be uploaded within the next day or so.

-- 
Oliver Elphick[EMAIL PROTECTED]
Isle of Wight  http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
 
 "Who shall ascend into the hill of the LORD? or who 
  shall stand in his holy place? He that hath clean 
  hands, and a pure heart..."Psalms 24:3,4 





[SQL] Cache look up failure

2000-11-29 Thread Najm Hashmi

Hi All, I am trying to insert  a tuple in the tuple, and i am getting
the follwoing error message:

fliprdb=# insert into collection(name, artist_id) values('El Baile
Aleman',2);
ERROR:  fmgr_info: function 24011: cache lookup failed

Can someone help me out here. Thnaks in advance  for your help.
Najm




[SQL] Cache lookup failure

2000-11-29 Thread Najm Hashmi

Hi All,
I am trying to do a simple insert, and I am getting cache look failure
error.
Could someone explain what causing it? My query and error are given
below:
fliprdb=# insert into collection(name, artist_id) values('El Baile
Aleman',2);
ERROR:  fmgr_info: function 24011: cache lookup failed
Thanks in advance for all your help
Regards
Najm





Re: [SQL] Cache look up failure

2000-11-29 Thread Joel Burton



On 29 Nov 2000, at 17:56, Najm Hashmi wrote:

> Hi All, I am trying to insert  a tuple in the tuple, and i am getting
> the follwoing error message:
> 
> fliprdb=# insert into collection(name, artist_id) values('El Baile
> Aleman',2); ERROR:  fmgr_info: function 24011: cache lookup failed
> 
> Can someone help me out here. Thnaks in advance  for your help.
> Najm

Normally, the cache lookup error means you've done something like:

create table
create view on table
drop table
re-create table (perhaps slightly different)
select * from view

since the view calls the table by oid, not by name, it can't find the 
original table it uses.

for you, it sounds like

create function
create table-that-uses-function-somehow
drop function
re-create function
insert into table

Are there triggers on your table? Or rules? (Both of these might 
refer to functions that might have been changed.) Or, perhaps you 
have constraints on your table that call a function that you've re-
created.

If you have a backup of your database (ie pg_dumpall), you can 
grep this file for 24011. This should be the original oid of the 
function that is lost.

Good luck!

--
Joel Burton, Director of Information Systems -*- [EMAIL PROTECTED]
Support Center of Washington (www.scw.org)



Re: [SQL] Cache lookup failure

2000-11-29 Thread Stephan Szabo


Do you have any triggers, rules or check constraints defined on the
table?  If so, you may have fallen pray to the thing that you cannot
drop and re-create a function that's used in a trigger without recreating
the trigger as well.

Stephan Szabo
[EMAIL PROTECTED]

On Wed, 29 Nov 2000, Najm Hashmi wrote:

> Hi All,
> I am trying to do a simple insert, and I am getting cache look failure
> error.
> Could someone explain what causing it? My query and error are given
> below:
> fliprdb=# insert into collection(name, artist_id) values('El Baile
> Aleman',2);
> ERROR:  fmgr_info: function 24011: cache lookup failed
> Thanks in advance for all your help
> Regards
> Najm
> 
> 




[SQL] subselects

2000-11-29 Thread Joseph Shraibman

 
I tried to do this:
 SELECT r , a , (SELECT u , re FROM dir WHERE u = a) , cdate FROM rep
WHERE m IN(190);

... and I got:

ERROR:  Subselect must have only one field

An explain shows that two subselects result in two queries, even thought
they are accessing the same row.  Why can subselects only have one
field?

Database version: PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc
egcs-2.91.66

-- 
Joseph Shraibman
[EMAIL PROTECTED]
Increase signal to noise ratio.  http://www.targabot.com



[SQL] Subselect in join?

2000-11-29 Thread Kenn Thompson

Ok- Seems I've seen this somewhere, but can't seem to get it to work. Is my memory 
flawed, or is this just not an implemented feature?

SELECT * FROM (SELECT foo, bar FROM tfoobar)

In english- is it not possible to to a subselect in a FROM clause?

Kenn



Kenn Thompson
Senior Web Architect
Adesta Communications
Work: 402.233.7595
Cell: 402.210.6326





Re: [SQL] Subselect in join?

2000-11-29 Thread Philip Warner

At 18:24 29/11/00 -0600, Kenn Thompson wrote:
>
>In english- is it not possible to to a subselect in a FROM clause?
>

In 7.1.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.B.N. 75 008 659 498)  |  /(@)   __---_
Tel: (+61) 0500 83 82 81 | _  \
Fax: (+61) 0500 83 82 82 | ___ |
Http://www.rhyme.com.au  |/   \|
 |----
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/



[SQL] delete rows

2000-11-29 Thread Astrid Hexsel

Hello All,

 After trying for two weeks to delete more than one row at the time from a form
- checkbox input, I was told that the only way different rows would be inputed
or changed with the information from the form would be with the INSERT command.


This way the best alternative I could think of, would be 
to still have my table cart:
For eaxmple:

session_id|range_id|colour_id|
--
122   | 4004-4 | 4002 
122   | 4004-4 | 4003
122   | 4004-4 | 4004

which contains all the items added to the cart.

Then when a deletion is required, the information from the form would be inserted
into "cartchange table":
For example:

session_id| colour_id|condition|
-
122   | 4001   | yes
122   | 4002   | yes 


Now what I am trying to do is to delete the rows
from cart that appear in the cartchange table.

I have tried to join the tables , but I could not find the right query to delete
similar rows.

Am I missing something here ?

Any help will be extremely appreciated. :)

Astrid




Re: [SQL] delete rows

2000-11-29 Thread Stephan Szabo


On Thu, 30 Nov 2000, Astrid Hexsel wrote:

>  After trying for two weeks to delete more than one row at the time from a form
> - checkbox input, I was told that the only way different rows would be inputed
> or changed with the information from the form would be with the INSERT command.
> 
> 
> This way the best alternative I could think of, would be 
> to still have my table cart:
> For eaxmple:
> 
> session_id|range_id|colour_id|
> --
> 122   | 4004-4 | 4002 
> 122   | 4004-4 | 4003
> 122   | 4004-4 | 4004
> 
> which contains all the items added to the cart.
> 
> Then when a deletion is required, the information from the form would be inserted
> into "cartchange table":
> For example:
> 
> session_id| colour_id|condition|
> -
> 122   | 4001   | yes
> 122   | 4002   | yes 
> 
> 
> Now what I am trying to do is to delete the rows
> from cart that appear in the cartchange table.
> 
> I have tried to join the tables , but I could not find the right query to delete
> similar rows.

Would a subselect work here?  something like...
delete from cart where exists (select * from cartchange where
 cartchange.session_id=cart.session_id and 
 cartchange.colour_id=cart.colourid);




[SQL] alter table question

2000-11-29 Thread Joseph Shraibman

How do I alter a table to set a column to be not null?



-- 
Joseph Shraibman
[EMAIL PROTECTED]
Increase signal to noise ratio.  http://www.targabot.com



[SQL] Rules with Conditions: Bug, or Misunderstanding

2000-11-29 Thread Joel Burton

Am I misunderstanding how to use rule w/conditionals, or is there a 
bug in this?

--

I love to use Pgsql comments, but find the 'comment on field...' 
language a bit of a pain for documenting a large database at the 
last minute. So, I wrote a query that pulls together all the fields in a 
database, w/descriptions (if any):

create view dev_col_comments as 
select a.oid as att_oid, 
relname, 
attname, 
description 
from pg_class c, 
pg_attribute a left outer join pg_description d on d.objoid=a.oid
where c.oid=a.attrelid
and (c.relkind='r' or c.relkind='v') and c.relname !~ '^pg_'
and attname not in ('xmax','xmin','cmax','cmin','ctid','oid','tableoid')
order by relname, attname;

[This uses pg7.1 syntax; you could rewrite for 7.0 w/o the 'v' for 
views, and using a union rather than outer join.]

This works great. Feeling clever, I wrote two rules, so I could 
update this and create comments. I need two rules, one if this is an 
existing description (becoming an update to pg_description), one if 
this not (becoming an insert to pg_description).

create rule dev_ins as on update to dev_col_comments where 
old.description isnull do instead insert into pg_description ( objoid, 
description) values (old.att_oid, new.description);

create rule dev_upd as on update to dev_col_comments where 
old.description notnull do instead update pg_description set 
description=new.description where objoid=old.att_oid;

This doesn't work: I get a "cannot update view w/o rule" error 
message, both for fields where description was null, and for fields 
where it wasn't null.

If I take out the "where old.description isnull" clause of dev_ins, it 
works fine--but, only, of course, if I am sure to only pick new 
descriptions. Or, if I take out the clause in dev_upd, it works too, 
with the opposite caveat.

Is this a bug? Am I misunderstanding something about the way that 
rule conditions should work? The docs are long but fuzzy on rules 
(they seem to suggest, for instance, that "create rule foo on 
update to table.column" will work, when this is not implemented yet, 
so perhaps the docs are ahead of the implementation?)

Any help would be great!

I do read the pgsql lists, but always appreciate a cc, so I don't miss 
any comments. TIA.

Thanks,

--
Joel Burton, Director of Information Systems -*- [EMAIL PROTECTED]
Support Center of Washington (www.scw.org)



Re: [SQL] Rules with Conditions: Bug, or Misunderstanding

2000-11-29 Thread Tom Lane

"Joel Burton" <[EMAIL PROTECTED]> writes:
> create rule dev_ins as on update to dev_col_comments where 
> old.description isnull do instead insert into pg_description ( objoid, 
> description) values (old.att_oid, new.description);

> create rule dev_upd as on update to dev_col_comments where 
> old.description notnull do instead update pg_description set 
> description=new.description where objoid=old.att_oid;

> This doesn't work: I get a "cannot update view w/o rule" error 
> message, both for fields where description was null, and for fields 
> where it wasn't null.

Hm.  Perhaps the "cannot update view" test is too strict --- it's not
bright enough to realize that the two rules together cover all cases,
so it complains that you *might* be trying to update the view.  As the
code stands, you must provide an unconditional DO INSTEAD rule to
implement insertion or update of a view.

I'm not sure this is a big problem, though, because the solution is
simple: provide an unconditional rule with multiple actions.  For
example, I think this will work:

create rule dev_upd as on update to dev_col_comments do instead
(
  insert into pg_description (objoid, description)
select old.att_oid, new.description WHERE old.description isnull;
  update pg_description set description=new.description
where objoid = old.att_oid;
)

but I haven't tried it...

regards, tom lane