CREATE TABLE forcehol ( w_id integer NOT NULL, bday date NOT NULL, duration integer NOT NULL, eday date NOT NULL DEFAULT (now() + '1 mon'::interval), CONSTRAINT "force_PK" PRIMARY KEY (w_id, bday),
);
and have ths child of it
CREATE TABLE adminhol ( -- Inherited: w_id integer NOT NULL, -- Inherited: bday date NOT NULL, -- Inherited: duration integer NOT NULL, -- Inherited: eday date NOT NULL DEFAULT (now() + '1 mon'::interval), CONSTRAINT "admin_PK" PRIMARY KEY (w_id, bday),
) INHERITS (forcehol) ;
I have pushed a lot of data into forcehol and adminhol
I use "SELECT * from ONLY forcehol" to see raws.
Now about the question:
Using library postgresql-8.2-505.jdbc3.jar I have such class
class A{
private Connection conn; private ResultSet rs;
public A(){
try{ //make coonnection to DB ... //get result Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); rs = stat.executeQuery("SELECT * from ONLY forcehol"); //now, I'm trying to add new row into the forcehol table
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 --> //here we have exception with the text "No primary key found for table ONLY" rs.moveToInsertRow();
How can I beat such exception about unccorect analysing of my query with ONLY syntax? ResultSet keep the nesessary rows, but I can't insert, udate or dalete any new rows.