Re: Compare with default value?

From: Ulrich Goebel <ml(at)fam-goebel(dot)de>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Compare with default value?
Date: 2021-03-13 20:41:13
Message-ID: cb794244-9b40-4561-41ce-3632d6ede8fe@fam-goebel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)fam-goebel(dot)de
> <mailto:ml(at)fam-goebel(dot)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’ ?

What I want to build is a more ore less generic app, completes a row
(orig) in an table with data from another row (complete). That only for
the cols where the orig holds the default value. The app shouldn't know
to much about the table structure. It should work like that:

for col in columns
if orig.col is not the default
orig.col = complete.col
update orig in the database
delete complete

It is somewhat unclear for me whicht part of the problem is do be coded
in a SQL-Statement and which part in my programming language (Python3).
But it could help to get a reference to the default value.

Ulrich

--
Ulrich Goebel
Am Büchel 57, 53173 Bonn

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2021-03-13 20:50:49 Re: Compare with default value?
Previous Message Adrian Klaver 2021-03-13 20:22:56 Re: How to recover data from 9.3 data directory