tag:blogger.com,1999:blog-2356137376934964551.post3116940692286442220..comments2023-06-14T06:01:24.499-04:00Comments on Andrew Dunstan's PostgreSQL and Technical blog: A record with all defaultsAndrew Dunstanhttp://www.blogger.com/profile/04684286585449188201noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-2356137376934964551.post-80269085846175427162015-11-14T12:20:26.592-05:002015-11-14T12:20:26.592-05:00Well, there you go. I learn something new every da...Well, there you go. I learn something new every day. Thanks for the info all.Andrew Dunstanhttps://www.blogger.com/profile/04684286585449188201noreply@blogger.comtag:blogger.com,1999:blog-2356137376934964551.post-37284315501023107312015-11-14T11:00:40.186-05:002015-11-14T11:00:40.186-05:00Or in 9.4, INSERT INTO foo SELECT;
But that’s jus...Or in 9.4, INSERT INTO foo SELECT;<br /><br />But that’s just for fun. The DEFAULT VALUES solution above is the right way to go.Unknownhttps://www.blogger.com/profile/13478279217856598617noreply@blogger.comtag:blogger.com,1999:blog-2356137376934964551.post-68137938792362137052015-11-14T10:47:34.167-05:002015-11-14T10:47:34.167-05:00As said above, "insert into mytable default v...As said above, "insert into mytable default values returning my_id;" is much cleaner.xocolatlhttps://www.blogger.com/profile/10075944893945740105noreply@blogger.comtag:blogger.com,1999:blog-2356137376934964551.post-71798594812091476132015-11-14T10:44:34.739-05:002015-11-14T10:44:34.739-05:00Or, better: INSERT INTO foo DEFAULT VALUES;
Work...Or, better: INSERT INTO foo DEFAULT VALUES;<br /><br />Works even if the table has no columns.johtopghttps://www.blogger.com/profile/09661075169749802223noreply@blogger.com