From: | Postgres User <postgres(dot)developer(at)gmail(dot)com> |
---|---|
To: | Diego Augusto Molina <diegoaugustomolina(at)gmail(dot)com>, "pgsql-general\"" <pgsql-general(at)postgresql(dot)org>, osvaldo(dot)kussama(at)gmail(dot)com |
Subject: | Re: Indicating DEFAULT values in INSERT statement |
Date: | 2011-08-09 23:56:38 |
Message-ID: | CADecbQmiFoGb3Z0A+t=2YK=R0pO26Ux6noiuQbQ5RnS5PCS9VQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for the previous posts. I am in fact running 9.0 'nix and am unable
to find a way to embed DEFAULT within an expression.
I can always rewrite the function to call EXECUTE but that's not a very good
solution in this case because many of our db functions are code generated.
On Tue, Aug 9, 2011 at 4:47 PM, Diego Augusto Molina <
diegoaugustomolina(at)gmail(dot)com> wrote:
> Hi, when posting SQL it may be a good practice to post your PG
> version so that answers may be more accurate and better fit your
> needs. In this case, I don't think you'll be able to do what you are
> trying to, because as of my understanding the "DEFAULT" is not part of
> an expression but a keyword itself which is to be written *instead* of
> an expression. I get your point and seems pretty fair to me, but if
> I'm right you don't have access to the default value of the column
> from within an expression.
> Assuming you're using the latest stable version of PostgreSQL (9.0
> as of today), you can check the following page for an online reading
> reference of the INSERT statement:
> http://www.postgresql.org/docs/9.0/interactive/sql-insert.html
> If you look carefully, you'll see that for the value of a column you
> may write: the "DEFAULT" keyword [exclusive or] an expression (which
> includes specific values).
> The [exclusive or] is deduced because of the pipe (`|') between the
> two choices which are embraced by curly braces.
> So, if you were able to use the "DEFAULT" keyword inside an
> expression, instead of having the "{ expression | DEFAULT }" syntax
> you would have the "expression" syntax, which would include the case
> of having just "DEFAULT" as an expression. It's just a matter of
> understanding the syntax.
>
> Cheers!
>
> --
> Diego Augusto Molina
> diegoaugustomolina(at)gmail(dot)com
>
> ES: Por favor, evite adjuntar documentos de Microsoft Office. Serán
> desestimados.
> EN: Please, avoid attaching Microsoft Office documents. They shall be
> discarded.
> LINK: http://www.gnu.org/philosophy/no-word-attachments.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Diego Augusto Molina | 2011-08-10 00:35:13 | Re: Indicating DEFAULT values in INSERT statement |
Previous Message | Diego Augusto Molina | 2011-08-09 23:47:50 | Re: Indicating DEFAULT values in INSERT statement |