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 1qJyNX-0002iU-LM for pgsql-sql@arkaria.postgresql.org; Thu, 13 Jul 2023 15:37:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qJyNW-0007dg-87 for pgsql-sql@arkaria.postgresql.org; Thu, 13 Jul 2023 15:37:14 +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 1qJyNV-0007dX-TE for pgsql-sql@lists.postgresql.org; Thu, 13 Jul 2023 15:37:13 +0000 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qJyNO-000D71-D2 for pgsql-sql@lists.postgresql.org; Thu, 13 Jul 2023 15:37:12 +0000 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-56669eb7565so1277794eaf.0 for ; Thu, 13 Jul 2023 08:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689262626; x=1691854626; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HE4qtmryxRA46vxP3ognuFDUL6+oeYgdHerDvNNmQ3c=; b=NeEv8NlK/cTHpS8cPYw1MlkjH/uNC02Dy7RCLXaRQcB1Qt/ZEYSUwwVpn0HUFpabpi vbgMXcPoN5DEAvQH3fbTTNxghJForBi+HeD0ZTRNv5ckfpSl44uk8WpkQlUXfNgYf8YZ MTQPImMS1kcHfau4dDFx9JpQL9kwYW+/pjxv8bbn4vPiqnbx5xspUIb7T8VS2OAPH+ab lRWz+kMtEB3oz7x1O2V5MsE68jx9Qed4EKVxvuNhK6pM5NxIgpRJowSVHLUUZRGhMbv2 qi/e7os7GsBKFeQYMzB15lU5dKZ+zTUslypX4E2WymoF+0q1jNmm1WXU2Z6GKkootumc MssQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689262626; x=1691854626; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HE4qtmryxRA46vxP3ognuFDUL6+oeYgdHerDvNNmQ3c=; b=brHosuOYUypnNXV+byp6EGl4U6ooKt21m4KdeUZPOLfB3xcewKzPee1zlsHL7oWl86 f2juLPhqAulizm8H+10fYgw99UdYA9BofzPDoRisxXxXNGmWLVMXJflisBmpK0VwhZIN W1u2Vk4ysnphUiOQ1z7o/m4hx4Mf/3ne9uVn3jikP3o6x9vjJbSbyMED9OjY2Eh4Xq6T YsX3inMbr1YHpaown7gYBRNZc0aH688as9Ub/83xTKjCvqJglwsSxOumLmMva6T4Yl71 ThWeujPGmW4lH2mlh5AYcksdNOA1R2+L70STN8KOfoJHihpggcLt+TKHmrPamzYTPMY1 x8aA== X-Gm-Message-State: ABy/qLYXa71gTjO9rk9D2I/SKppq1d8HABTCVM8+oRXM5huEBU/BcbhI DTU6LmzSqsVGIbjuE5ww5h7gkBJEx/Y90BNsUOU= X-Google-Smtp-Source: APBJJlFwk4CvYU/hhpAmwsZLbJPxEh5aYf7it+UdXiOMJWA1tvKZeUozFIy77dQz9cHbdSU9n+w1iX66qCa+jtiL8Ww= X-Received: by 2002:a05:6808:998:b0:3a3:e80a:7d5f with SMTP id a24-20020a056808099800b003a3e80a7d5fmr8213oic.18.1689262626244; Thu, 13 Jul 2023 08:37:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "David G. Johnston" Date: Thu, 13 Jul 2023 08:36:48 -0700 Message-ID: Subject: Re: Can we set time exception? To: Shaozhong SHI Cc: pgsql-sql Content-Type: multipart/alternative; boundary="000000000000c50dcc0600601a96" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c50dcc0600601a96 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jul 13, 2023 at 7:46=E2=80=AFAM Shaozhong SHI wrote: > In a Do statement, it calls function to work? > > Can we set a time exception? > > If the function responds with result in a given time, we take the result. > > If the response of the function exceeds the time set, skip it. > > No. Function execution happens on a single thread (i.e., synchronous) in a stacked manner. There is no way for the caller to get processing control back other than the callee returning. If your choice of procedural language can overcome the synchronous execution limitation then sure. SQL and pl/pgsql cannot. David J. --000000000000c50dcc0600601a96 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jul 13, 2023 at 7:46=E2=80=AFAM Shaozhong SHI <= shishaozhong@gmail.com> wr= ote:
In a Do statement, it calls f= unction to work?

Can we set a time exception?
=
If the function responds with result in a given time, we tak= e the result.

If the response of the function exce= eds the time set, skip it.


=
No.=C2=A0 Function execution happens on a single thread (i.e., syn= chronous) in a stacked manner.=C2=A0 There is no way for the caller to get = processing control back other than the callee returning.

=
If your choice of procedural language can overcome the synchronous=C2=A0= execution limitation then sure.=C2=A0 SQL and pl/pgsql=C2=A0cannot.

David J.
--000000000000c50dcc0600601a96--