[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [GENERAL] Issue with default values and Rule
From:       Dev Kumkar <devdas.kumkar () gmail ! com>
Date:       2014-02-28 4:43:28
Message-ID: CALSLE1Nfvp+LuJyZQO8LEvwu2qUwJtm-WXxOZG83DpBJJptqsg () mail ! gmail ! com
[Download RAW message or body]

On Thu, Feb 27, 2014 at 11:17 PM, Adrian Klaver
<adrian.klaver@aklaver.com>wrote:

> That works because you said NULL is a valid value for the column. If you
> had specified NOT NULL then you would get an error about violating the NOT
> NULL constraint. Since you have said NULL is a valid value and you actually
> specified it in the INSERT the following applies:
>
> http://www.postgresql.org/docs/9.3/interactive/sql-createtable.html
>
> DEFAULT default_expr
>  ....
>
>     The default expression will be used in any insert operation that does
> not specify a value for the column. If there is no default for a column,
> then the default is null.


Hmm, so looks like there is no generic way out here to handle this in case
of rules.

Regards...

[Attachment #3 (text/html)]

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 27, 2014 \
at 11:17 PM, Adrian Klaver <span dir="ltr">&lt;<a \
href="mailto:adrian.klaver@aklaver.com" \
target="_blank">adrian.klaver@aklaver.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">That works because you said NULL is a valid value for the \
column. If you had specified NOT NULL then you would get an error about violating the \
NOT NULL constraint. Since you have said NULL is a valid value and you actually \
specified it in the INSERT the following applies:<br>

<br>
<a href="http://www.postgresql.org/docs/9.3/interactive/sql-createtable.html" \
target="_blank">http://www.postgresql.org/<u></u>docs/9.3/interactive/sql-<u></u>createtable.html</a><br>
 <br>
DEFAULT default_expr<br>
 ....<br>
<br>
    The default expression will be used in any insert operation that does not specify \
a value for the column. If there is no default for a column, then the default is \
null.</blockquote></div><br>Hmm, so looks like there is no generic way out here to \
handle this in case of rules. <br> <br></div><div \
class="gmail_extra">Regards...<br></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic