Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 55668 invoked from network); 31 Aug 2006 08:54:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Aug 2006 08:54:26 -0000 Received: (qmail 68248 invoked by uid 500); 31 Aug 2006 08:54:26 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 67858 invoked by uid 500); 31 Aug 2006 08:54:25 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 67847 invoked by uid 99); 31 Aug 2006 08:54:25 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Aug 2006 01:54:25 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.1.36] (HELO gmpea-pix-1.sun.com) (192.18.1.36) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Aug 2006 01:54:24 -0700 Received: from d1-emea-09.sun.com (d1-emea-09.sun.com [192.18.2.119] (may be forged)) by gmpea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k7V8rdX2023320 for ; Thu, 31 Aug 2006 09:53:43 +0100 (BST) Received: from conversion-daemon.d1-emea-09.sun.com by d1-emea-09.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0J4U00301TCRJC00@d1-emea-09.sun.com> (original mail from Bernt.Johnsen@Sun.COM) for derby-user@db.apache.org; Thu, 31 Aug 2006 09:53:39 +0100 (BST) Received: from [129.159.112.201] by d1-emea-09.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0J4U00EB5U19ZFE8@d1-emea-09.sun.com> for derby-user@db.apache.org; Thu, 31 Aug 2006 09:53:34 +0100 (BST) Date: Thu, 31 Aug 2006 10:53:29 +0200 From: "Bernt M. Johnsen" Subject: Re: SQL Parser failing on NULL column contraint In-reply-to: <44F67DEB.2040103@xtra.co.nz> Sender: Bernt.Johnsen@Sun.COM To: Derby Discussion Reply-to: Bernt.Johnsen@Sun.COM Message-id: <44F6A389.7020409@Sun.COM> Organization: Sun Microsystems MIME-version: 1.0 Content-type: multipart/signed; boundary=------------enig3B37DF953C4B0D66C367971C; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Enigmail-Version: 0.94.0.0 References: <44F3087F.1020006@intland.com> <44F34597.4090902@gmail.com> <44F587AA.8060007@xtra.co.nz> <44F5AE95.2010907@amberpoint.com> <44F67DEB.2040103@xtra.co.nz> User-Agent: Thunderbird 1.5.0.4 (X11/20060516) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------enig3B37DF953C4B0D66C367971C Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I can't see any reason why anyone would spend time on this issue. 1) "NULL" is not a constraint. All columns are nullable by default (SQL standard and in all SQL databases to my knowledge). 2) It will not add any new functionality. 3) You will not gain anything in speed, resource usage etc. 4) By removing the "NULL constraint" from your create statements, they will work with Derby and be portable back to the database that allowed them (if it is a reasonable implementation of SQL). 5) The SQL standard does not allow this syntax, so by incorporating it into Derby we run the risk that some uses it and creates SQL statements that are not portable to other databases. So, I wonder: Why bother? Duncan Groenewald wrote: > Thanks - is there any documentation on how the parser works and > explaining what is the sqlgrammer.jj file is and how is it used, etc. > > Duncan > > Bryan Pendleton wrote: >> Duncan Groenewald wrote: >>> Any chance someone can explain how I could modify the parser (or >>> whatever) to be able to handle the NULL constraint ? >> >> Beware: I haven't tried this, but you could have a look at >> java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj and >> experimentally try to modify it for yourself. >> >> In terms of the modifications, I think you'll want to look at the >> subroutine columnConstraint(), and observe how the explicitNotNull >> and explicitNull flags are handled. >> >> Notice that there is an explicit parser block for >> >> >> >> I think you'll either want to add a second explicit parser block for >> >> >> >> or modify the existing one to >> >> [] >> >> and either way you want to make sure that you manage the explicitNull >> and explicitNotNull flags properly, and that you call setNullability()= >> on the dataTypeDescriptor to record the user's NULL / NOT NULL choice.= >> >> Hope this helps, >> >> bryan >> >> >> > --=20 Bernt Marius Johnsen, Database Technology Group, Staff Engineer, Technical Lead Derby/Java DB Sun Microsystems, Trondheim, Norway --------------enig3B37DF953C4B0D66C367971C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE9qOMlFBD9TXBAPARAqL4AJ0VINya2GxzNkyXkWsLPtnP/7ENZACdHYHt fdDr9Fpf7xCmM9Eg3Ih6zG0= =zDc2 -----END PGP SIGNATURE----- --------------enig3B37DF953C4B0D66C367971C--