Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJySN-0068PM-Uq for pgsql-general@arkaria.postgresql.org; Sat, 07 Dec 2024 17:19:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tJySK-00GB1i-V7 for pgsql-general@arkaria.postgresql.org; Sat, 07 Dec 2024 17:19:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJySJ-00GB1a-MN for pgsql-general@lists.postgresql.org; Sat, 07 Dec 2024 17:19:01 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tJySC-001XY9-83 for pgsql-general@lists.postgresql.org; Sat, 07 Dec 2024 17:18:59 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id E5B5A2540176; Sat, 7 Dec 2024 12:18:49 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Sat, 07 Dec 2024 12:18:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1733591929; x=1733678329; bh=tCyHLYw50vlOr26U9yba9BIsVTZpEbfz+Fi4aYxUBcc=; b= Dy+rO0tfDIqkzZTWvJJJAexQ+pll4BufaAOtmqesb+XrC6knBdZEC9f4n0vvQdkG iJohXNuG21su+8FReqB6TstemHe6/WoJh3mICnX3/vXwUWls8VkW2EOGzYu9JkTU MC5cHrVs7vNq4He8lbVQOn2vGrOZhd2l2AceGnXw9QnM0InF6y4EfMqWiPKi4/zY zsLLlZZojRs3ob9RBKq5LZACpFMacXOoI1v0BIRff7rNWU8ALhdHnibBRIhqH+Mv tptZb6CpALZ9PVlVIlhCpwkZ3BF5e3w6qIYy9IKsA7cnd3noaFMxW3jPaqlUlWL3 a3MkqhtvOdo4/szTcfVtJg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1733591929; x=1733678329; bh=t CyHLYw50vlOr26U9yba9BIsVTZpEbfz+Fi4aYxUBcc=; b=oGVCKg6Grsrha/zKV qutEZpoy/wnLdhLf/MVkCXH8Ck9oRAeKe5LzUtA6IWv1MGwvzcf+k7lwuAyEPxsC nkEJgolDPQM3MjdIxEjjYYIBLlnO3oDSZr+mnA3sD0SFAgB+SUqojQhqxKlVQZm/ /xV2q5WX3Z/fIR8heeVpv/gJwq+rrzXQ07B4VB66ZaquwGtqx3jUSat8Ad5d12qH wX1/8EEbOa9YnAK0NMzg0jGYvkpiHCPsvhIjJeEcseexvLqWvFjawd6xW1so/viG 6kXE3nhl4gFc8lARKzo/PbjczejvBYJPzxvTtZQ2DEsakHJemPyaKNhYzOsyKfcq labpA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrjedugdeljecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdejnecu hfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrg hklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepiedvhfeiheehgeeuieeljeei tedtjeehudegfeelkedvleekhedtgfeiffefkedunecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgr vhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhkohhrohhttddusehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhq lhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 7 Dec 2024 12:18:48 -0500 (EST) Message-ID: <8770b693-0c44-40de-b883-36cc5e718a0a@aklaver.com> Date: Sat, 7 Dec 2024 09:18:48 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Insert records in the tavke only if they are not exist To: Igor Korot , "pgsql-generallists.postgresql.org" References: Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/6/24 19:36, Igor Korot wrote: > Hi, All, > > When my application starts up, ot creates some tables and insert records > in them. > > When the app starts for the second time it should check if the tables > and the records in them are exist and skip the process. Does this also apply to starts after the second time? Is the data expected to change over time? > > Everything is good, except what if I have a connection from 2 different > users? Is it possible to have the app start up without external users connecting? > > I can run this inside transaction, but will this be enough? Will stating > transaction lock the DB and the second user will wait for transaction to > complete? > > Thank you. > -- Adrian Klaver adrian.klaver@aklaver.com