Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j1t4s-0004rH-CJ for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2020 14:33:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j1t4r-0004hR-0T for pgsql-general@arkaria.postgresql.org; Wed, 12 Feb 2020 14:33:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j1t4q-0004hK-Ha for pgsql-general@lists.postgresql.org; Wed, 12 Feb 2020 14:33:20 +0000 Received: from mail-il1-x143.google.com ([2607:f8b0:4864:20::143]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j1t4n-0000Lq-Rl for pgsql-general@lists.postgresql.org; Wed, 12 Feb 2020 14:33:19 +0000 Received: by mail-il1-x143.google.com with SMTP id p8so1881682iln.12 for ; Wed, 12 Feb 2020 06:33:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=fiIwoNXoLRbEGigrhD8QluFkfoRcQuMQGLP+jaaRo1M=; b=V2sJ4nK5wDXbwiRu2edS84w1/psqGPk+CBMCikcQhIR/BzXCMd31yADDKtZQllcRBU AZostl45GM3Oqib4FHEH7fHMYnZtHDguDYRbZy5em2J1KFEIeAEMyoqpSdd05IOT1Jbi +og6LSMAOYGfrtUo/ygP3+aiunjtlE4nuQxjhRf6dHws3I0VU6coFMv3tEG45gxX4EEx 1IwQYKTkhihtJP/1028r+8VNSWkzzNCZUtj6oWWw1OeoOmV11RsOiESlzF8GyEKkoiJP G47m7hDwbp6WhHjI1NnnoZIFpApuazicK6HfISK+WRVz2LM6W8BbcxIeQ065utYorNFE 3tng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=fiIwoNXoLRbEGigrhD8QluFkfoRcQuMQGLP+jaaRo1M=; b=WYBXAdjDkHtowAPBF+mnuWAMtz2PfOAwCfp4SSRUz4fBy04apgqGdyj0vvVbU2iAeP RHkJ651PJ25P978bnsQ/szUgjMm+bbkjDndg6gnyAn+wX7wx9o7DZgR2wi0QNokUGH5z /X0TvJyLiGMhuNLLBiXK6emVEsl0I/npFMnIV6l/j97VTtuARJgDOIA1NvgDnJxjK2/j kN44OCjn/PTL1meOJBxz8AxZ4yTs666HxwFbDfgPqpO5PLSoGWD5/YZD3VSMlSYOraBm +e6wT3DBWBkTvMFIiWvKbgSTxNewW37zulbNZkTMoM7YHVaMDvh/Yv+9Bbr8NOhVpU3w CmwQ== X-Gm-Message-State: APjAAAVD0H4IE7o8cH6NDf40FO/2pDl9E5nk8Mh7vifa/e/KuiAsvYHR 5wxkEM8KThXqqmwp2xNze2WAjjUN X-Google-Smtp-Source: APXvYqw8t5bUGVgDiGPP6C8XInBUDe81GKDOlWZzNauOEDEzsuidSazFYa3Fp3sH7Ft/rqfrKrDEEA== X-Received: by 2002:a92:88c4:: with SMTP id m65mr11531422ilh.165.1581517996801; Wed, 12 Feb 2020 06:33:16 -0800 (PST) Received: from ?IPv6:2601:681:5500:dde0:303c:c966:8f2a:5e1? ([2601:681:5500:dde0:303c:c966:8f2a:5e1]) by smtp.gmail.com with ESMTPSA id x13sm115506ioj.80.2020.02.12.06.33.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 06:33:16 -0800 (PST) Content-Type: multipart/alternative; boundary=Apple-Mail-55EF4514-91AF-4CC4-94FD-03E7BD06B232 Content-Transfer-Encoding: 7bit From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: Help : Removal of leading spaces in all the columns of a table Date: Wed, 12 Feb 2020 07:33:15 -0700 Message-Id: <67357700-F84A-4910-88AC-C1851CCE807D@gmail.com> References: <63f2ef022e503f62aaefb798e4bd6a7e@mail.brookhurstdata.net> Cc: pgsql-general@lists.postgresql.org In-Reply-To: <63f2ef022e503f62aaefb798e4bd6a7e@mail.brookhurstdata.net> To: susan.hurst@brookhurstdata.com X-Mailer: iPhone Mail (17D50) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail-55EF4514-91AF-4CC4-94FD-03E7BD06B232 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Feb 12, 2020, at 7:09 AM, Susan Hurst w= rote: >=20 > =EF=BB=BF > I once wrote a trigger function to do just what you asked, however, it was= a huge drain on performance so I didn't use it for long, so I dropped the t= rigger. Hopefully, someone has a more practical approach. I would be inter= ested in this also. >=20 > Sue >=20 > --- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Susan E Hurst > Principal Consultant > Brookhurst Data LLC > Email: susan.hurst@brookhurstdata.com > Mobile: 314-486-3261 >> On 2020-02-12 06:42, srikkanth wrote: >>=20 >> Hi Team, >> =20 >> How can i write the syntax to remove the leading spaces on a table for al= l the columns. >> =20 >> Also, want to know how to do the all words of all the columns in capital a= long with removing of leading\excessive\trailing spaces at a time. >>=20 >> Can you please help me out, let me know in case of any For larger production tables I would stream the converted data through COPY i= nto a new table of identical shape, build indeces then rename both and trunc= ate/drop old table.=20 --Apple-Mail-55EF4514-91AF-4CC4-94FD-03E7BD06B232 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Feb 12, 2020, at 7:09 AM, Susan Hurst <= susan.hurst@brookhurstdata.com> wrote:

=EF=BB=BF

I once wrote a trigger function to do just what you asked, however, it wa= s a huge drain on performance so I didn't use it for long, so I dropped the t= rigger.  Hopefully, someone has a more practical approach.  I woul= d be interested in this also.

Sue

---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Susan E Hurst Principal Consultant Brookhurst Data LLC Email: susan.hurst@brookhurstdata.com Mobile: 314-486-3261

On 2020-02-12 06:42, srikkanth wrote:

Hi Team,

 

How can i write the syn= tax to remove the leading spaces on a table for all the columns.

 

Also, want to know how t= o do the all words of all the columns in capital along with removing of lead= ing\excessive\trailing spaces at a time.

Can you please help me out, l= et me know in case of any


For larger production tables I would stream the c= onverted data through COPY into a new table of identical shape, build indece= s then rename both and truncate/drop old table. 

= --Apple-Mail-55EF4514-91AF-4CC4-94FD-03E7BD06B232--