From: Tim Cross <theophilusx@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Compare with default value?
Date: Sun, 14 Mar 2021 08:21:37 +1100
Message-ID: <8735wy20sz.fsf@gmail.com> (raw)
In-Reply-To: <cb794244-9b40-4561-41ce-3632d6ede8fe@fam-goebel.de>
References: <f36e9ea9-6a08-fc2b-0c77-c0a952db9976@fam-goebel.de>
<CAKFQuwY4XByLxZ4BA3J2TDQ2a8QhOypY2ZVrt1CYUH_t9Z1mwQ@mail.gmail.com>
<cb794244-9b40-4561-41ce-3632d6ede8fe@fam-goebel.de>
Ulrich Goebel <ml@fam-goebel.de> writes:
> Hi,
>
> o.k. I have to give some more information...
>
> Am 13.03.21 um 19:39 schrieb David G. Johnston:
>> On Saturday, March 13, 2021, Ulrich Goebel <ml@fam-goebel.de
>> <mailto:ml@fam-goebel.de>> wrote:
>>
>> I would like to get the rows, where a column has the default value,
>> similar to:
>> select id fromt tbl where col = default
>>
>> If the default is a simple constant then why go through the trouble instead of
>> just writing col = ‘constant’ ?
>
I think you may need to re-think your design or at least come at it from
a different perspective. As shown by another post in the thread, at some
level, this is 'sort of' possible, but it will be ugly and fragile.
Possibly one of the issues you have is on one hand, you want the
solution to be as generic as possible, but on the other, you require it
to have specific knowledge about the definition of your table. i.e.
which column(s) have a default value. Furthermore, your 'completion'
table will need to be defined based on this information i.e. potentially
multiple columns with multiple different data types etc.
While the additional information you provided does give some increased
understanding of what your trying to do, it is still describing your
desired solution implementation. It might be better if you provide more
high level details of what your attempting to do so that we can better
understand how you arrived at the proposed solution and whether there
may be better alternatives available.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: theophilusx@gmail.com
Subject: Re: Compare with default value?
In-Reply-To: <8735wy20sz.fsf@gmail.com>
References: <f36e9ea9-6a08-fc2b-0c77-c0a952db9976@fam-goebel.de> <CAKFQuwY4XByLxZ4BA3J2TDQ2a8QhOypY2ZVrt1CYUH_t9Z1mwQ@mail.gmail.com> <cb794244-9b40-4561-41ce-3632d6ede8fe@fam-goebel.de> <8735wy20sz.fsf@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox