Search Postgresql Archives

Re: Compare with default value?

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

 



Hi,

Am 13.03.21 um 22:21 schrieb Tim Cross:

Ulrich Goebel <ml@xxxxxxxxxxxxx> 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@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’ ?


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.

Yes, I am re-thinking allredy...


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.

o.k.: For a conference I have a tbl_person which holds all peoble which are involved: participants and people which provide private lodgins for other participants. (There are much more roles, but for illustration these two should be enough.) Of course each person can have one or more roles at the conference, a n-n-relation models that. Now our workflow allows that one person find it way in the tbl_person twice (ore even more often): for example the conference office generates a row for Tom, because he provides private lodgin. Later on Tom decides to participate an fills the online registration formular. These data generate the second row for Tom. Both rows hold significant information which the other doesn't hold. Let's say the online register gave the birthday, the other holds information about the lodgin (bed with or without breakfast). The next step then is that the conference office get notice of the doubled person an should make one row out of the existing two rows. The office decide which of the two rows should be completed with data from the other row. Therefore I would like to pick the columns in the first row where we have default values and replace it by the value from the second row.

There are more ways to end with two or even more rows per person. May be it would have been much better to avoid these possibilities. But for the moment I have a given database structure running in productive mode, so it is not easy to re-structure the structure or even the workflows...

Thanks for patience reading all that!

--
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