agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH v1 4/6] meson: Implement getopt logic from autoconf
4+ messages / 3 participants
[nested] [flat]
* [PATCH v1 4/6] meson: Implement getopt logic from autoconf
@ 2022-09-28 17:06 Andres Freund <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Andres Freund @ 2022-09-28 17:06 UTC (permalink / raw)
Not replacing getopt/getopt_long definitely causes issues on mingw. It's not
as clear whether the solaris & openbsd aspect is still needed, but if not, we
should remove it from both autoconf and meson.
---
meson.build | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index cd410319f3f..48b0b4cbed8 100644
--- a/meson.build
+++ b/meson.build
@@ -2265,6 +2265,15 @@ posix4_dep = cc.find_library('posix4', required: false)
getopt_dep = cc.find_library('getopt', required: false)
gnugetopt_dep = cc.find_library('gnugetopt', required: false)
+# Check if we want to replace getopt/getopt_long even if provided by the system
+# - We want to use system's getopt_long() only if system provides struct
+# option
+# - Mingw has adopted a GNU-centric interpretation of optind/optreset,
+# so always use our version on Windows
+# - On OpenBSD and Solaris, getopt() doesn't do what we want for long options
+# (i.e., allow '-' as a flag character), so use our version on those platforms
+always_replace_getopt = host_system in ['windows', 'openbsd', 'solaris']
+always_replace_getopt_long = cdata.get('HAVE_STRUCT_OPTION', 1) != 1 or host_system == 'windows'
# Required on BSDs
execinfo_dep = cc.find_library('execinfo', required: false)
@@ -2295,8 +2304,8 @@ func_checks = [
['explicit_bzero'],
['fdatasync', {'dependencies': [rt_dep, posix4_dep], 'define': false}], # Solaris
['getifaddrs'],
- ['getopt', {'dependencies': [getopt_dep, gnugetopt_dep]}],
- ['getopt_long', {'dependencies': [getopt_dep, gnugetopt_dep]}],
+ ['getopt', {'dependencies': [getopt_dep, gnugetopt_dep], 'skip': always_replace_getopt}],
+ ['getopt_long', {'dependencies': [getopt_dep, gnugetopt_dep], 'skip': always_replace_getopt_long}],
['getpeereid'],
['getpeerucred'],
['inet_aton'],
--
2.37.3.542.gdd3f6c4cae
--3mylvpkolouaexyj
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v1-0005-mingw-Define-PGDLLEXPORT-as-__declspec-dllexport-.patch"
^ permalink raw reply [nested|flat] 4+ messages in thread
* bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
@ 2025-12-27 07:58 jian he <[email protected]>
2025-12-27 08:32 ` Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint Srinath Reddy Sadipiralla <[email protected]>
0 siblings, 1 reply; 4+ messages in thread
From: jian he @ 2025-12-27 07:58 UTC (permalink / raw)
To: pgsql-hackers
hi.
while working on let ALTER COLUMN SET DATA TYPE cope with trigger dependency.
I found this bug, it involves several ALTER COLUMN SET DATA TYPE calls.
DROP TABLE IF EXISTS main_table;
CREATE TABLE main_table (a int, b int, check(a = b));
ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE numeric;
ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE int;
ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE text;
ALTER TABLE main_table ALTER COLUMN b SET DATA TYPE text;
INSERT INTO main_table VALUES ('a', 'a');
This also applies to statistics, indexes. for statistics: the error is only
observable after running ANALYZE manually.
--
jian
https://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
2025-12-27 07:58 bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint jian he <[email protected]>
@ 2025-12-27 08:32 ` Srinath Reddy Sadipiralla <[email protected]>
2025-12-27 11:32 ` Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint jian he <[email protected]>
0 siblings, 1 reply; 4+ messages in thread
From: Srinath Reddy Sadipiralla @ 2025-12-27 08:32 UTC (permalink / raw)
To: jian he <[email protected]>; +Cc: pgsql-hackers
Hi Jian,
On Sat, Dec 27, 2025 at 1:28 PM jian he <[email protected]> wrote:
> hi.
>
> while working on let ALTER COLUMN SET DATA TYPE cope with trigger
> dependency.
> I found this bug, it involves several ALTER COLUMN SET DATA TYPE calls.
>
> DROP TABLE IF EXISTS main_table;
> CREATE TABLE main_table (a int, b int, check(a = b));
> ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE numeric;
> ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE int;
> ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE text;
> ALTER TABLE main_table ALTER COLUMN b SET DATA TYPE text;
> INSERT INTO main_table VALUES ('a', 'a');
>
> This also applies to statistics, indexes. for statistics: the error is only
> observable after running ANALYZE manually.
>
Yeah, I can easily reproduce this.
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint
2025-12-27 07:58 bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint jian he <[email protected]>
2025-12-27 08:32 ` Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint Srinath Reddy Sadipiralla <[email protected]>
@ 2025-12-27 11:32 ` jian he <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: jian he @ 2025-12-27 11:32 UTC (permalink / raw)
To: Srinath Reddy Sadipiralla <[email protected]>; +Cc: pgsql-hackers
On Sat, Dec 27, 2025 at 4:32 PM Srinath Reddy Sadipiralla
<[email protected]> wrote:
>>
>
> Yeah, I can easily reproduce this.
>
hi.
thinking about it more...
I tend to think it's not a bug.
because SET DATA TYPE changes the CHECK constraint definition.
>> DROP TABLE IF EXISTS main_table;
>> CREATE TABLE main_table (a int, b int, check(a = b));
>> ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE numeric;
>> ALTER TABLE main_table ALTER COLUMN a SET DATA TYPE int;
At this stage, the constraint definition is no longer "a = b",
it becomes "(a::numeric = b::numeric)", which is different from "(a = b)".
sorry for the noise.
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2025-12-27 11:32 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 17:06 [PATCH v1 4/6] meson: Implement getopt logic from autoconf Andres Freund <[email protected]>
2025-12-27 07:58 bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint jian he <[email protected]>
2025-12-27 08:32 ` Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint Srinath Reddy Sadipiralla <[email protected]>
2025-12-27 11:32 ` Re: bug: repeated ALTER COLUMN SET DATA TYPE corrupt check constraint jian he <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox