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 1mZH6I-0002WH-VI for pgsql-sql@arkaria.postgresql.org; Sat, 09 Oct 2021 18:29:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mZH6G-0005qP-5q for pgsql-sql@arkaria.postgresql.org; Sat, 09 Oct 2021 18:29:36 +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 1mZH6F-0005qG-RS for pgsql-sql@lists.postgresql.org; Sat, 09 Oct 2021 18:29:35 +0000 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mZH69-0008If-9N for pgsql-sql@lists.postgresql.org; Sat, 09 Oct 2021 18:29:34 +0000 Received: by mail-il1-x12f.google.com with SMTP id r9so13614597ile.5 for ; Sat, 09 Oct 2021 11:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=vLE304breBunqYHM2NU1GY2WJXZgH3mZ5/mDc8tmUpQ=; b=ckJa1KJVKI5Ywm9Mqlv6qbylzFBdojAr2eBVeVPrmoCh/1Ev+aq6hKVUvvbYv188tZ 9s/N9/9MLK1BSPTANeOpEakhnSMw3Q7WlFRrnWDXJu0h30VXcwM5uDlYl/T8RuWYBN4f 10BxxosRoOUc12v2VTL0jw+iB1dKYtAwwpam92W9EcyklJWqq7C8qv9asojh95AjbHTS yFzhU78BcyredRHAGRZVCcU50pkGKdIpJiH9diTtyzMvSzpBwl2n5kPl44LlurBdt7ZA dZ8TRwrWJK0n0Ulx9LZFgsYpwSiGRzIY9vkE5zt/F6a/cjO/X4h64znOetceI8gGZT0K bTVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=vLE304breBunqYHM2NU1GY2WJXZgH3mZ5/mDc8tmUpQ=; b=LcwsTkonNQsYxpwFxYAMAE1SZTHJEqi1brjaGe1ztbnSBtplV1SNScU/w0eS23rAEv lsMN26uoh/AaayXkaZaT2oHlzcS8iQJ8BHW1ly9xEhRVeaLjg4bbdDB54PUGDa32Rxxy m4yzoa8Ry7M5n9nxyCgPmZIwiOQlziCf2KB5fHMr1bU/9iJn5h0MDhY3Fqb9c6vJeKhw jqDcXHJRP2obUVHxpnRM+6dsUK4tz1KQeEtJUEG8RMX/0DiT5tcpNIwIcVQQQG5simRV P/aSq3J0fwJc5gZv4Zd7gDUUhVuOrwm3qo7fuoNCNI8vpU9+a37XFDq8tg7DKB84O+6A Nb9A== X-Gm-Message-State: AOAM533pr4t5P4hhOx53KWtc5AvabKkmIVkllDs3jNxpsIBq4Zj+qJ63 l/w+Ap60uVtwJZP+0LINSz5jHcZiBSI= X-Google-Smtp-Source: ABdhPJy6X2OUHmR8zl3BSRbHNHItGzrvaCExn4nIs3MyF2U/Dwu3+wWKqrs2YNIrw46AVZASIorOog== X-Received: by 2002:a05:6e02:bcb:: with SMTP id c11mr12735159ilu.286.1633804168292; Sat, 09 Oct 2021 11:29:28 -0700 (PDT) Received: from smtpclient.apple (c-24-11-95-247.hsd1.ut.comcast.net. [24.11.95.247]) by smtp.gmail.com with ESMTPSA id o1sm1480089ilj.41.2021.10.09.11.29.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Oct 2021 11:29:27 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: How to capture error message and save to a table in PostgreSQL? Date: Sat, 9 Oct 2021 12:29:27 -0600 Message-Id: <4A26A02A-318A-4F46-B18B-860AE3756727@gmail.com> References: Cc: pgsql-sql@lists.postgresql.org In-Reply-To: To: Karsten Hilbert X-Mailer: iPhone Mail (18G82) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Oct 9, 2021, at 12:22 PM, Karsten Hilbert wro= te: >=20 > =EF=BB=BFAm Fri, Oct 08, 2021 at 10:45:45AM +0100 schrieb Shaozhong SHI: >=20 >> I wish to test out to produce a table when data violates constraints when= >> insert into a new table with constraint set. How to capture and save err= or >> message to a new table? >=20 > That depends on how you access the table and at which level > you wish the above to happen. >=20 > You need to be less generic to get better help. >=20 If there is a client application involved you might be better off validating= the input there rather than going all the way to the server with bad data.=20= >=20