[SQL] Need help form inherits

2004-08-01 Thread Patrice OLIVER
Hello everybody,
I would like to use inherits between 2 tables :
user(login,password)
and
studiant(firstname, lastname, email)
these tables are created like this :
create table user (
login varchar(15) not null primary key,
password varchar(32));
create table studiant (
firstname varchar(35),
lastname varchar(35),
email varchar(255)
) inherits user;
The problem is that a studiant can become a user of the site to consult 
its results. Members of user table are actually secretaries, who 
administer exams ...

so, if I create un user :
insert into user values ('por',md5('tototo'));
and I want know to say that the user 'por' becomes a studiant. How can I 
do this ?
In the other way, to say that a studiant is also a user, I just have to do :

insert into studiant 
('kml',md5('tititi'),'Michel','Michelle','[EMAIL PROTECTED]');

And all is ok.
Thanks for your help.
Patrice
begin:vcard
fn:Patrice OLIVER
n:OLIVER;Patrice
email;internet:[EMAIL PROTECTED]
x-mozilla-html:FALSE
version:2.1
end:vcard


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


Re: [SQL] How to create an aggregate?

2004-08-01 Thread Greg Stark

Ray Aspeitia <[EMAIL PROTECTED]> writes:

> I also would like to pass the delimiter to the aggregate as a parameter and
> I am not sure if it can handle that.

Currently aggregates that take multiple parameters are just not supported.

-- 
greg


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


[SQL] Help on triggers

2004-08-01 Thread Pradeepkumar, Pyatalo (IE10)

Hi all,

I have 2 tables - table1 and table2. Both the tables are related to each
other. I have written triggers so that if a tuple is inserted into table1,
corresponding values will be inserted into table2. and if a tuple is deleted
from table1 then corresponding tuples are deleted from table2 also. The
delete trigger works fine sometimes and other times it gives the following
error.

delete from table1 where pointid=30;
ERROR: update or delete on "table1" violates foreign key constraint "$2" on
"table2"
DETAIL: key (pointid) =30 is still referenced from table "pointattributes".

I am doing an application in C. I have written a C-function using libpq API
to delete a tuple from table1. that is I pass a parameter to the function
and it has to delete the tuple whose primarykey value= parameter and also
delete correspoding tuples from table2(due to the trigger). so i have formed
a simple delete command on table2in the C-function. When i compile the
application it gives the same error:

is there anyone who can explain why this is happening. I had posted this
query 2 days back...dint get any reply. Please help me out with this.



> With Best Regards 
> Pradeep Kumar P J 
> 

---(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


[SQL] error in compiling the function -- need help !!!

2004-08-01 Thread Pradeepkumar, Pyatalo (IE10)


> Hi ,
> 
> I have attached the function that I am trying to run. But I am getting the
> following error -
> 
> select * from pp_readenum('STAT42','PointDefinitionType')  as alias;
> ERROR: syntax error at or near ";"
> CONTEXT: compile of PL/pgSQL function "pp_readenum" near line 41 
> <> 
> 
> I have checked the function many timesI could not figure out what
> could be wrongany help on this.
> 
>   With Best Regards 
>   Pradeep Kumar P J 
> 


Procedures.sql
Description: Binary data

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


[SQL] org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:143)

2004-08-01 Thread Smita Marda
Hi,
I have been using SOFIA framework and postgres
database as a backend.
i noticed as the database started growing larger..
today
encountered some error while firing a query to save a
record. The table in which i am going to save the
record, has two columns having datatype text. the data
of these two column contains 2652 and 5817 characters.
If I reduce some characters from both columns, it
saves the record successfully. But i reduce some
characters from only single column(whether it has 2652
chars or 5817 chars whereas both have the same
datatype), it gives me the following error :--

[Stack Trace
The backend has broken the connection. Possibly the
action you have attempted has caused it to close.
at
org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:143)
at
org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:68)
at
org.postgresql.Connection.ExecSQL(Connection.java:398)
at
org.postgresql.jdbc2.Statement.execute(Statement.java:130)
at
org.postgresql.jdbc2.Statement.executeUpdate(Statement.java:73)
at
org.postgresql.jdbc2.PreparedStatement.executeUpdate(PreparedStatement.java:113)
at
com.salmonllc.sql.DSDataSourceJDBC.updateRow(DSDataSourceJDBC.java:753)
at
com.salmonllc.sql.DataStore.update(DataStore.java:1965)
at
com.salmonllc.sql.DataStore.update(DataStore.java:1907)
at
com.eq.model.operations.contractChargeModel.update(contractChargeModel.java:426)
at
com.eq.model.operations.ContractWrapModel.update(ContractWrapModel.java:381)
at
com.eq.controller.operations.contractDefineVariableChargesController.submitPerformed(contractDefineVariableChargesController.java:153)
at
com.salmonllc.html.HtmlSubmitButton.executeEvent(HtmlSubmitButton.java:126)
at
com.salmonllc.jsp.JspForm.executeEvent(JspForm.java:270)
at
com.salmonllc.html.HtmlContainer.executeEvent(HtmlContainer.java:82)
at
com.salmonllc.html.HtmlPage.processParms(HtmlPage.java:1263)
at
com.salmonllc.jsp.JspController.doPost(JspController.java:554)
at
com.salmonllc.jsp.tags.PageTag.doStartTag(PageTag.java:188)
at
org.apache.jsp.contractDefineVariableCharges_jsp._jspx_meth_salmon_page_0(contractDefineVariableCharges_jsp.java:164)
at
org.apache.jsp.contractDefineVariableCharges_jsp._jspService(contractDefineVariableCharges_jsp.java:130)
at
com.salmonllc.jsp.JspServlet.service(JspServlet.java:300)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
com.eq.src.compressionFilters.CompressionFilter.doFilter(CompressionFilter.java:238)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.Sta