Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLBwS-0007YB-ET for pgsql-general@arkaria.postgresql.org; Sat, 13 Mar 2021 21:37:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lLBwR-0000oG-9e for pgsql-general@arkaria.postgresql.org; Sat, 13 Mar 2021 21:36:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLBwQ-0000kF-VE for pgsql-general@lists.postgresql.org; Sat, 13 Mar 2021 21:36:59 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lLBwK-0006LN-DB for pgsql-general@lists.postgresql.org; Sat, 13 Mar 2021 21:36:57 +0000 Received: by mail-pl1-x62a.google.com with SMTP id f8so13487plg.10 for ; Sat, 13 Mar 2021 13:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=h7qZozL/lGOPCyk4UuXBu7yV/F71JUpxJBrboMkpySg=; b=d08/PZ3F8gy8nUQgfm4DB3+0dfbv3bLvgnSo88eVca1tAH7/4kY4WqgJs4sY0vfXXA WHwe+al5M0FFcCz+0/RHXS2vR0azPRjdaGTiOTL1rCJVhWyYkUUx3HKSSPiZBx3H732h /yfwbebIscU2iQBB65z1gO9VVzHeE2cy/P9dVuyStF66OqoAVCcr0EsKOx2+xaUGWvoA GP9esiPAR2HW4UuFILJlunEkbr/NfQp+c/iHIqZt9iNNWkjN5PFAXmSGmvgkKAs++ZNH +Ki6DHmt224cmEKdG76evTK0chFjhZEsyDC9Lt7N8oW4Mly6NLaMIpBw4UoGpKWS2gIz jhYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=h7qZozL/lGOPCyk4UuXBu7yV/F71JUpxJBrboMkpySg=; b=f0fVgifXpoBKsSeKxY9aMMdC7Onzdq7hhpQfh1bPp2peEerxkty4oBimg8xy+0qv1U wR1UEAEc3XTq6HcdimaNiuJ6ibkAAH38SzoHEWF269jBSiyp80TyPpiwodve4HEqft0g /hNVgFPlQfhRcB3m+M47lVHw62KvfD3aCNgMvbmNYxh3/1FM2NXPdyCfDDc4bAZY5NlO pQKyUxWIjlvebpXOSjf1b1mpWKyz++iY/zMz9VPDmh0IEHnZsGxVUzYoBoknSpi4zBPv L4B2cjy7xA+FwBFcS8Qk9Pk4FXrZOQ6Mnw61XlMY2gclIfm3h8fR+UgQ8uXO8eejPOUX Rhmw== X-Gm-Message-State: AOAM5320ik402RNxwLgPoeir8sNM3E+K2F2EiPwQ6EfJLxalB0dTCQDh 5229Stci34NpGa6UDwMFUY25VbMwV0k= X-Google-Smtp-Source: ABdhPJzsYBvxVAsqTDLoiSmmWhE/MpliTAFHss24E5BIUS/fNhIUgjYsXA5LZQPurbj/yFCqTbHuxQ== X-Received: by 2002:a17:90b:903:: with SMTP id bo3mr5440277pjb.198.1615671410810; Sat, 13 Mar 2021 13:36:50 -0800 (PST) Received: from tim-desktop (203-206-0-178.dyn.iinet.net.au. [203.206.0.178]) by smtp.gmail.com with ESMTPSA id k63sm9654761pfd.48.2021.03.13.13.36.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Mar 2021 13:36:50 -0800 (PST) References: User-agent: mu4e 1.5.10; emacs 27.1.91 From: Tim Cross To: pgsql-general@lists.postgresql.org Subject: Re: Compare with default value? Date: Sun, 14 Mar 2021 08:21:37 +1100 In-reply-to: Message-ID: <8735wy20sz.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ulrich Goebel 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 > > wrote: >> >> I would like to get the rows, where a column has the default value, >> similar to: >> select id fromt tbl where col =3D default >> >> If the default is a simple constant then why go through the trouble inst= ead of >> just writing col =3D =E2=80=98constant=E2=80=99 ? > 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.