| From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
|---|---|
| To: | Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: referencing other INSERT VALUES columns inside the insert |
| Date: | 2015-11-17 16:21:27 |
| Message-ID: | 564B5407.9090407@BlueTreble.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 11/17/15 8:53 AM, Geoff Winkless wrote:
> It takes the column's default value, since it's not explicit in the
> first INSERT.
Not sure if it would help or not, but you can use pg_get_expr(adbin,
adrelid) against pg_attrdef to get the default for a column. That would
let you dynamically insert the expression that generates the default
value into the VALUES clause.
start psql with the -E option and do \d on a table with e default to see
this in action.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Willy-Bas Loos | 2015-11-17 20:49:04 | Re: database corrupt |
| Previous Message | Jim Nasby | 2015-11-17 16:12:03 | Re: Querying same lookup table with multiple columns based on another view |