From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Noah Misch <noah@leadboat.com>
Cc: hofstetter@jomasoft.ch
Subject: Re: Solaris "sed" versus pre-v13 plpython tests
Date: Wed, 31 Aug 2022 20:57:22 -0400
Message-ID: <222938.1661993842@sss.pgh.pa.us> (raw)
In-Reply-To: <165561.1661984701@sss.pgh.pa.us>
References: <165561.1661984701@sss.pgh.pa.us>
I wrote:
> I confirmed on the gcc farm's Solaris 11 box that the pattern
> doesn't work as expected with /usr/bin/sed:
> tgl@gcc-solaris11:~$ echo except foo, bar: | sed -e 's/except \([[:alpha:]][[:alpha:].]*\), *\([[:alpha:]][[:alpha:]]*\):/except \1 as \2:/g'
> except foo, bar:
> We could perhaps do this instead:
> $ echo except foo, bar: | sed -e '/^ *except.*,.*: *$/s/, / as /g'
> except foo as bar:
> It's a little bit more brittle, but Python doesn't allow any other
> commands on the same line does it?
Oh ... after a bit more experimentation, there's an easier way.
Apparently the real problem is that Solaris' sed doesn't handle
[[:alpha:]] (I wonder if this is locale-dependent?). I get
correct results after expanding it manually, eg
tgl@gcc-solaris11:~$ echo except foo, bar: | sed -e 's/except \([a-z][a-z.]*\), *\([a-z][a-zA-Z]*\):/except \1 as \2:/g'
except foo as bar:
We aren't likely to need anything beyond a-zA-Z and maybe 0-9,
so I'll go fix it that way.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org, noah@leadboat.com, hofstetter@jomasoft.ch
Subject: Re: Solaris "sed" versus pre-v13 plpython tests
In-Reply-To: <222938.1661993842@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox