| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, ewie(at)ewie(dot)name |
| Subject: | Re: Fix psql pager selection for wrapped expanded output |
| Date: | 2026-06-13 01:03:25 |
| Message-ID: | F4AAA073-D3B4-4240-9BFF-64B0152227F7@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Jun 12, 2026, at 22:44, Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> On 2026-Jun-12, Chao Li wrote:
>
>> BTW, I also ran into another issue that confused me. After changing
>> print.c, running make from the source root didn’t rebuild psql. I had
>> to run "make clean" and rebuild everything. Is that known or
>> intentional?
>
> Do you use "configure --enable-depend"? If not, then I think you're
> pretty much expected to do "make clean" or similar before every single
> file change. I think this as a very developer unfriendly environment,
> so I always use configure --enable-depend. (Well, except when on Meson
> of course, which is what I normally use for most recent branches.)
>
> --
> Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
> Thou shalt check the array bounds of all strings (indeed, all arrays), for
> surely where thou typest "foo" someone someday shall type
> "supercalifragilisticexpialidocious" (5th Commandment for C programmers)
I’m using --enable-depend. I have this configure command in my notes, and I always copy it when I need to reconfigure:
```
./configure --enable-debug --enable-cassert --enable-tap-tests --enable-depend --with-python --enable-injection-points
```
I just looked into the problem. After changing print.c, only libpgfeutils.a is rebuilt. psql runs submake-libpgfeutils, but it does not have libpgfeutils.a as a normal prerequisite, so it is not relinked when the archive changes.
I made a simple change like this:
```
diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile
index be0032652cd..d12bcfcc660 100644
--- a/src/bin/psql/Makefile
+++ b/src/bin/psql/Makefile
@@ -23,6 +23,7 @@ REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
+libpgfeutils = $(top_builddir)/src/fe_utils/libpgfeutils.a
OBJS = \
$(WIN32RES) \
@@ -46,9 +47,11 @@ OBJS = \
all: psql
-psql: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
+psql: $(OBJS) $(libpgfeutils) | submake-libpq submake-libpgport
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $(at)$(X)
+$(libpgfeutils): | submake-libpgfeutils
+
help.o: sql_help.h
# See notes in src/backend/parser/Makefile about the following two rules
```
It simply adds libpgfeutils.a as a normal prerequisite of psql, while still using submake-libpgfeutils to build it. Then psql is automatically relinked when print.c changes and the archive is rebuilt.
I didn’t check if meson has the same issue. If this is considered worth a patch, I can start a new thread.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Jeff Davis | 2026-06-13 00:25:05 | Re: Commit Sequence Numbers and Visibility |