X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 15DC03A4211 for ; Fri, 7 Jan 2005 07:33:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88709-01 for ; Fri, 7 Jan 2005 07:33:06 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id A95EE3A45C9 for ; Fri, 7 Jan 2005 07:33:06 +0000 (GMT) Received: from localhost (dsl-082-082-069-206.arcor-ip.net [82.82.69.206]) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id j077WwE14670; Fri, 7 Jan 2005 08:32:58 +0100 Subject: Re: (resend) NULL constrains inheritance to views From: Markus Bertheau To: Bradley Kieser Cc: PgSQL ADMIN In-Reply-To: <41DD6FE6.1090306@kieser.net> References: <41DD6FE6.1090306@kieser.net> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-omX+zjeCs/YT1xP5nJwv" Date: Fri, 07 Jan 2005 08:33:01 +0100 Message-Id: <1105083181.3525.1.camel@fc3> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/39 X-Sequence-Number: 15898 --=-omX+zjeCs/YT1xP5nJwv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable You could probably construct the views manually by creating tables with a ON SELECT rule. =D0=A3 =D0=A7=D1=82=D0=B2, 2005-01-06 =D1=83 17:05 +0000, Bradley Kieser = =D0=BF=D0=B8=D1=88=D0=B5: > (resend as my other mail seems to not have gotten through) >=20 > I have created a schema with views on top of tables. We use JDBC to=20 > connect to the schema and we use JBuilderX to develop our app. >=20 > Every table as an "id" column of type serial. I.e. It is not null with=20 > default nextval(...). > However, it seems that when a column from a table is used in a view, the=20 > not null part (as well as the default values) seems to be dropped. > Serials become integers. >=20 > I can use "alter table" to restore default values on the views, but=20 > "alter table" to make a view column not null results in an error saying=20 > that the viewname is not a table! I.e. I don't seem to be able to make=20 > the column not null. >=20 > I think that this is throwing JBuilder's resolver into chaos because it=20 > doesn't use the column that I have specified as ROWID (column "id" for=20 > each view) to resolve update rows back to the view, it tries to use=20 > every single column, a sure sign that it thinks that the column I have=20 > told it is a rowid isn't up to the job. I am pretty certain that it's=20 > because it thinks that column can be null. >=20 > Unfortunately I have to use views and cannot use tables because of=20 > security in the app. The views have rules set on them as well as=20 > permissions to specific users. So the answer isn't to open up the=20 > database and use the underlying tables instead. That would open a=20 > security hole in the app. Moreover, I use views to do complex processing=20 > in PG (e.g. multi-table joins or rules and triggers on updates to ensure=20 > data integrity and implement business logic). JBuilder, being a RAD is=20 > great at building apps from simple datasets (i.e. single views and=20 > tables), but it quickly starts to wilt under complex parametised queries! >=20 > So for these reasons I need to find a way to tell JBuilder (through=20 > JDBC) that the ID columns are not nullable. But how? Can someone please=20 > help me? >=20 > Thanks, >=20 > Brad >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org --=20 Markus Bertheau --=-omX+zjeCs/YT1xP5nJwv Content-Type: application/pgp-signature; name=signature.asc Content-Description: =?koi8-u?Q?=E3=C0?= =?koi8-u?Q?_=DE=C1=D3=D4=C9=CE=D5?= =?koi8-u?Q?_=D0=CF=D7=A6=C4=CF=CD=CC=C5=CE=CE?= =?koi8-u?Q?=D1?= =?koi8-u?Q?_=D0=A6=C4=D0=C9=D3=C1=CE=CF?= =?koi8-u?Q?_=C3=C9=C6=D2=CF=D7=C9=CD?= =?koi8-u?Q?_=D0=A6=C4=D0=C9=D3=CF=CD?= -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBB3jss2RUnMPztcykRAvpMAJ9Rv1MCdnne1TdJ1+73Dx8WHfpuPQCfYO8j sywyYhyhSTbUbHc450yyLs0= =IhHv -----END PGP SIGNATURE----- --=-omX+zjeCs/YT1xP5nJwv--