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 1sWi0H-00GquN-TU for pgsql-general@arkaria.postgresql.org; Wed, 24 Jul 2024 19:50:26 +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 1sWi0F-008JSG-CY for pgsql-general@arkaria.postgresql.org; Wed, 24 Jul 2024 19:50:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWi0D-008JS8-2s for pgsql-general@lists.postgresql.org; Wed, 24 Jul 2024 19:50:22 +0000 Received: from fhigh7-smtp.messagingengine.com ([103.168.172.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWi09-001FvI-GQ for pgsql-general@postgresql.org; Wed, 24 Jul 2024 19:50:19 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 4B1A811401ED; Wed, 24 Jul 2024 15:50:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 24 Jul 2024 15:50:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc: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=fm2; t=1721850615; x=1721937015; bh=TlMagv7c8SqlyQbdCfxiMX2jUSa9S/Gak/Z9bY+ZozQ=; b= njILGCvtpLwLaQjcz3FaVl1KGyKP3Mx2rF7dqKeJKU8EL06OBdk2qCPxyxmKazh4 vHoROc8Jwg17HYVoiOUf31H2Xh4a6jYi+/+zAheXA3u7SaIdC9ugVbWIwzLkwdPM wbhhr5YqjMF4rxqwB+l0n47EvAxgtw4xdTL34EUETZH1+3HJpIWLSxFU3Tmujv3E 0V5u4gBnOxk7AVzZ2CZ3mXKn9wspmoon+TsuPEOzXSKAZMy9U02cSOh/Ovm6C/Gf E9aD/ajzhD3kKwpUTYhr/Rz00zWKx+H/DEWQ0BPdt7ls5Nia9rN9GVK+jgWAjUXP buGx9hHXEU6eVSXPkowiOA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1721850615; x= 1721937015; bh=TlMagv7c8SqlyQbdCfxiMX2jUSa9S/Gak/Z9bY+ZozQ=; b=K 4X4d9aQ6gPwY+4uzWjFRvGSeXAEOZy+RxjiR+xANTJZOCxFQKYPVSC32nj0v2HMa VYuW0ombVeEZi1+K9pFTzDL8tYegJwHiLNBS+BtvjZn7r+hw1UJGL7wYr+Y/HLv6 WWs33MHxzv0cKDDW1kJKtTO7xJYOwVxgbW1xfAxBC66rBqwysu72aYuXB07uA7Mi uWDto6xL9R2lDqdOgcuN/Jr0Ch2/ei3z+IPJAyEmN9bYIAF4AzmPd8ubUPlrlgdI itXsO7RAotJTT4buzYYGzn8p+ZrKyKDbqw6Dl6cEhZKaIGArC6qJdXoOHpHMv2KX AqIfD8QQm7FGYbxFbh1/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddriedugddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepgfdufeekhfevfeelveeiueevhedvuddukeduvddv lefhueeuieejtdeuvdevvdeunecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrgh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughr ihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedt X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 Jul 2024 15:50:14 -0400 (EDT) Message-ID: <419abc41-4683-4eaf-9381-0a1188a3e262@aklaver.com> Date: Wed, 24 Jul 2024 12:50:13 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: re-novice coming back to pgsql: porting an SQLite update statement to postgres To: Dan Kortschak , Dominique Devienne Cc: Vincent Veyron , pgsql-general@postgresql.org References: <1aea530e4c96109b91fdde53a29e38beb625dc77.camel@kortschak.io> <20240723221121.51f2b3872d0ebfc36a6fa8ff@wanadoo.fr> <2f11b2ba-3182-492a-ab46-23cfa5ec913c@aklaver.com> <735913e4c9601a2a7ad57d2253d74451c42ba899.camel@kortschak.io> Content-Language: en-US From: Adrian Klaver In-Reply-To: <735913e4c9601a2a7ad57d2253d74451c42ba899.camel@kortschak.io> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/23/24 17:23, Dan Kortschak wrote: > On 7/23/24 13:11, Vincent Veyron wrote: >> On Mon, 15 Jul 2024 20:31:13 +0000 >> >> This is the goto page for anything SQL : >> https://www.postgresql.org/docs/current/sql-commands.html >> >> For DateTime types : >> https://www.postgresql.org/docs/current/datatype-datetime.html >> >> For JSON types : >> https://www.postgresql.org/docs/current/datatype-json.html > > Thanks, I will work through those. > > > On Tue, 2024-07-23 at 23:52 +0200, Dominique Devienne wrote: >> On Tue, Jul 23, 2024 at 10:35 PM Adrian Klaver >> wrote: >>> Just know that SQLite does not enforce types [...] >> >> That's true, and applies to the OP's schema. > > Thank you both. Yes, I was aware of this weirdness of the schema (I > inherited it) and was shocked that it worked when I relaised. I'll be > happier when types are properly enforced, but I don't think I can > retrospectively enforce that on the SQLite implementation I have. > Which gets back to verifying the data coming from SQLite will work in the Postgres tables with the Postgres types specified in the table definitions. You can either: 1) Just import the data into the Postgres tables as defined and see if it works and if not what blows up. 2) Create Postgres staging tables that have all the column type's set to varchar or text for every column. Then import the data. Then you could do select col:: from the_table and see what works and what fails. -- Adrian Klaver adrian.klaver@aklaver.com