Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8uQ1-00021I-AW for pgsql-sql@arkaria.postgresql.org; Fri, 03 Jun 2016 19:06:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b8uQ0-0007j6-TZ for pgsql-sql@arkaria.postgresql.org; Fri, 03 Jun 2016 19:06:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b8uQ0-0007hD-9x for pgsql-sql@postgresql.org; Fri, 03 Jun 2016 19:06:04 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b8uPx-0000xQ-8l for pgsql-sql@postgresql.org; Fri, 03 Jun 2016 19:06:03 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id B3FE921D06; Fri, 3 Jun 2016 15:05:59 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Fri, 03 Jun 2016 15:05:59 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=TgNpiEGsGbJ5jomdeMeKCH3TQR8=; b=e2z7l7 FU1picNsLorSsQhelGDFwUb74ZvBt1H1VPAV97RmawbuWqjdp4ZPIt/r4EES6ZB4 074XXDK4uqLtWElVidgzLtTV68e5k2v3+af8PcxhFjGTlbgQrLb8t7kDdhhs5/5L djdap6Cn79+ISXpTNec0Xk0p/+WRIYN18pz+k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=TgNpiEGsGbJ5jom deMeKCH3TQR8=; b=LcHhEThkF6apkg3rvBfEvQTyIfKbZT0u4hdYD1ikDlY6G+7 MwiXNB4ABTW31E6oyPUVixEbuGm9qOBAb7ZnTxfqMbAzCeim9xkpJ5J80zJQB4RS 4tkMTYAEqKi5l6qcIyrxE29UEWCI9Yq+9WTwJRGtTp4qENnrfn/hqJZeSh2w= X-Sasl-enc: AOm1LiFA54r9NqsS5OH0xU2R7KjrNPooQ+ENix6CIgMD 1464980759 Received: from [192.168.1.2] (174-24-160-10.tukw.qwest.net [174.24.160.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 142C7CCD3B; Fri, 3 Jun 2016 15:05:58 -0400 (EDT) Subject: Re: NOT NULL CHECK (mycol !='') :good idea? bad idea? To: David W Noon , pgsql-sql@postgresql.org References: <5751D2C5.3080303@googlemail.com> From: Adrian Klaver Message-ID: Date: Fri, 3 Jun 2016 12:05:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <5751D2C5.3080303@googlemail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.7 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 06/03/2016 11:56 AM, David W Noon wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Fri, 3 Jun 2016 11:16:33 -0700, Michael Moore > (michaeljmoore@gmail.com) wrote about "[SQL] NOT NULL CHECK (mycol > !='') :good idea? bad idea?" (in > ): > >> In Oracle, a NOT NULL constraint on a table column of VARCHAR in >> essence says: "You need to put at least 1 character for a value". >> There is no such thing as a zero-length string in Oracle, it's >> either NULL or it has some characters. > > So Oracle is not compliant with ANSI standard SQL. Though it looks like they want to be: http://docs.oracle.com/database/121/SQLRF/sql_elements005.htm#SQLRF30037 "Note: Oracle Database currently treats a character value with a length of zero as null. However, this may not continue to be true in future releases, and Oracle recommends that you do not treat empty strings the same as nulls." -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql