[SQL] Function not running after upgrade 7.03 to 7.2

2002-06-14 Thread juerg . rietmann

I have three functions running under 7.03, Now, after the Upgrade to 7.2
these functions are not working.
What has changed in version 7.2 that causes this problem.

Function :

CREATE FUNCTION "buildUmfang"("bpchar") RETURNS "text" AS 'DECLARE
  list   text;
  rec  record;
BEGIN
list := ;
FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE z_u_typ = $1
LOOP
  list := list || text(rec.z_u_umfang) || '','';
END LOOP;
RETURN list;
END;

' LANGUAGE 'plpgsql';
COMMENT ON FUNCTION "buildUmfang"("bpchar") IS 'Diese Funktion generiert
einen String mit allen Umfängen zum übergebenen Zylindertyp\n\n';


Query :

SELECT *,
(SELECT rtrim(buildUmfang(zylinder.z_typ), ','::text) AS rtrim) AS umfang
FROM zylinder;

Thank's in advance for any help  jr


__

PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland

internet  :  www.pup.ch
phone   : +4141 790 4040
fax : +4141 790 2545
mobile: +4179 211 0315
__



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] Function not running after upgrade 7.03 to 7.2

2002-06-14 Thread Christopher Kings-Lynne

> Query :
>
> SELECT *,
> (SELECT rtrim(buildUmfang(zylinder.z_typ), ','::text) AS rtrim) AS umfang
> FROM zylinder;
>
> Thank's in advance for any help  jr

Try this:

SELECT *,
(SELECT rtrim("buildUmfang"(zylinder.z_typ), ','::text) AS rtrim) AS umfang
FROM zylinder;

I think it's because you have an upper case letter in the name - you might
need to quote it.

Chris


---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[SQL] ON DELETE CASCADE question

2002-06-14 Thread Wei Weng

Does ON DELETE CASCADE attribute you specify in CREATE TABLE statement
actually create triggers for every foreign key it refers to?

Thanks!


-- 
Wei Weng
Network Software Engineer
KenCast Inc.



---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [SQL] ON DELETE CASCADE question

2002-06-14 Thread Josh Berkus

Wei,

> Does ON DELETE CASCADE attribute you specify in CREATE TABLE
> statement
> actually create triggers for every foreign key it refers to?
>

Yes.  Two triggers for each key, I think.

-Josh

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [SQL] ON DELETE CASCADE question

2002-06-14 Thread Jan Wieck

Josh Berkus wrote:
> 
> Wei,
> 
> > Does ON DELETE CASCADE attribute you specify in CREATE TABLE
> > statement
> > actually create triggers for every foreign key it refers to?
> >
> 
> Yes.  Two triggers for each key, I think.

Three, one for INSERT OR UPDATE on the FK table, one
for UPDATE on the PK table and one for DELETE on PK.


Jan

-- 

#==#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.  #
#== [EMAIL PROTECTED] #

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



[SQL] function not running after upgrade from 7.03 to 7.2

2002-06-14 Thread juerg . rietmann

Hello

I have three functions running under 7.03, Now, after the Upgrade to 7.2
these functions are not working.
What has changed in version 7.2 that causes this problem.

Function :

CREATE FUNCTION "buildUmfang"("bpchar") RETURNS "text" AS 'DECLARE
  list   text;
  rec  record;
BEGIN
list := ;
FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE z_u_typ = $1
LOOP
  list := list || text(rec.z_u_umfang) || '','';
END LOOP;
RETURN list;
END;

' LANGUAGE 'plpgsql';
COMMENT ON FUNCTION "buildUmfang"("bpchar") IS 'Diese Funktion generiert
einen String mit allen Umfängen zum übergebenen Zylindertyp\n\n';


Query :

SELECT *,
(SELECT rtrim(buildUmfang(zylinder.z_typ), ','::text) AS rtrim) AS umfang
FROM zylinder;

Thank's in advance for any help  jr

__

PFISTER + PARTNER, SYSTEM - ENGINEERING AG
Juerg Rietmann
Grundstrasse 22a
6343 Rotkreuz
Switzerland

internet  :  www.pup.ch
phone   : +4141 790 4040
fax : +4141 790 2545
mobile: +4179 211 0315
__



---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



Re: [SQL] function not running after upgrade from 7.03 to 7.2

2002-06-14 Thread Jan Wieck

[EMAIL PROTECTED] wrote:
> 
> Hello
> 
> I have three functions running under 7.03, Now, after the Upgrade to 7.2
> these functions are not working.
> What has changed in version 7.2 that causes this problem.
> 
> Function :
> 
> CREATE FUNCTION "buildUmfang"("bpchar") RETURNS "text" AS 'DECLARE
>   list   text;
>   rec  record;
> BEGIN
> list := ;
> FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE z_u_typ = $1
> LOOP
>   list := list || text(rec.z_u_umfang) || '','';
> END LOOP;
> RETURN list;
> END;
> 
> ' LANGUAGE 'plpgsql';
> COMMENT ON FUNCTION "buildUmfang"("bpchar") IS 'Diese Funktion generiert
> einen String mit allen Umfängen zum übergebenen Zylindertyp\n\n';
> 
> Query :
> 
> SELECT *,
> (SELECT rtrim(buildUmfang(zylinder.z_typ), ','::text) AS rtrim) AS umfang
> FROM zylinder;
> 
> Thank's in advance for any help  jr

Without telling us at least the error message, or beeing a little more
precise what you consider "not working", it's just guessing.

What type is zylinder_umfang.z_u_umfang? Maybe the casting to text
doesn't work because the function text() is gone.


Jan
> 
> __
> 
> PFISTER + PARTNER, SYSTEM - ENGINEERING AG
> Juerg Rietmann
> Grundstrasse 22a
> 6343 Rotkreuz
> Switzerland
> 
> internet  :  www.pup.ch
> phone   : +4141 790 4040
> fax : +4141 790 2545
> mobile: +4179 211 0315
> __
> 
> ---(end of broadcast)---
> TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

-- 

#==#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.  #
#== [EMAIL PROTECTED] #

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



Re: [SQL] inheritance problems

2002-06-14 Thread Stephan Szabo

On Fri, 14 Jun 2002, Matt wrote:

> I have a parent with two columns, the primary key; several children
> inherit these columns.
>
> I can see all the childrens primary keys in the parent. however I can't
> reference data in the parent table that was entered into a child. I get
> a referential integrity violation. why is this? is there any way to
> change this behaviour. the purpose of haveing the parent was so that I
> could see the rows of two table in one place so that another table could
> indirectly reference the two of them. but this doesn't seem to behave
> the way it apears it should.

Inheritance has a bunch of problems currently including the fact that
primary keys, unique constraint, foreign keys and triggers don't inherit.
Foreign keys currently reference from only the table the constraint is on
to only the table the constraint names specifically (and none of the
children).

Depending on how flexible you are with changes to schema, there have been
some discussions of workarounds in the past.


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org