Le mardi 09 août 2011 à 15:57 -0700, Postgres User a écrit :
>
>
> From a db function, I'd like to force the use of default when an input
> parameter is null.
May be something like this :
CREATE TABLE users (
id serial NOT NULL,
username text NOT NULL,
is_active boolean DEFAULT
Le mardi 09 août 2011 à 15:57 -0700, Postgres User a écrit :
>
>
> From a db function, I'd like to force the use of default when an input
> parameter is null.
May be something like this :
CREATE TABLE users (
id bigint NOT NULL,
username text NOT NULL,
is_active boolean DEFAULT
Good idea but you're right, if the default value is an expression such as a
the next serial value, it will need to be executed first. If Execute
doesn't return the interpreted value, I don't know of a way to make it
work..
On Tue, Aug 9, 2011 at 5:35 PM, Diego Augusto Molina <
diegoaugustomol...@
This is a bit hacky, but it may work (I haven't tried it yet). If it
works let us know and if it doesn't then maybe we can debug it and get
something useful, or move on to another solution.
INSERT INTO public.test
(
userid, object_id, user_notes, object_status, created_ts
)
VALUES
(
p_userid, p_
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, 201
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 i