Search Postgresql Archives

Re: Compare with default value?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx <mailto:ml@xxxxxxxxxxxxx>> 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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux