Re: Saving view turns SELECT * into field list

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ben Uphoff <buphoff(at)villagemd(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Saving view turns SELECT * into field list
Date: 2018-10-15 19:55:21
Message-ID: CAKFQuwZ4cPRoaGx7N2dKmvYysJ5tBey+_nvWF0rkokYp21Eupw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, October 15, 2018, Ben Uphoff <buphoff(at)villagemd(dot)com> wrote:

>
> Why, when I save a simple view like:
>
>
>
> SELECT * FROM a_table
>
>
>
> …does PostgreSQL turn the * into a field list like:
>
>
>
> SELECT field1, field2, field3, field4 FROM a_table
>
>
>
Yes, deeply nesting views is a maintenance concern. It works this way so
the view remains stable (there may be others, the reasoning no longer
really matters...). If you really want dynamic SQL you will need to use a
function.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-10-15 21:25:51 Re: FATAL: terminating connection because protocol synchronization was lost
Previous Message Tom Lane 2018-10-15 19:55:11 Re: Saving view turns SELECT * into field list