Re: Setup in debian 13 (trixie): bugs + fixes
Karsten Hilbert <[email protected]> Mon, 18 Aug 2025 23:33:57 +0200
| Newsgroups | gmane.comp.gnu.medical.devel |
|---|---|
| Message-ID | <[email protected]> |
Am Sun, Aug 17, 2025 at 07:02:18PM -0300 schrieb Mar=EDa Scappini: > */DATABASE SETUP/* >=20 > *1- Syntax (?) error:* >=20 > See file attached for the tail of the log after the error (bootstrap_err= or_1.txt). Ran some > tests, did some tinkering. >=20 > Had to modify /var/lib/gnumed/server/bootstrap/bootstrap_gm_db_system.py= to fix. >=20 > Changing line 420 to 425... >=20 > =A0=A0=A0 curs =3D self.conn.cursor() > =A0=A0=A0 curs.execute(u"select setting from pg_settings where name =3D = 'lc_ctype'") > =A0=A0=A0 data =3D curs.fetchall() > =A0=A0=A0 lc_ctype =3D data[0][0] > =A0=A0=A0 _log.info(u'template database LC_CTYPE is [%s]', lc_ctype) > =A0=A0=A0 lc_ctype =3D lc_ctype.lower() >=20 > ... for this... >=20 > =A0=A0=A0 curs =3D self.conn.cursor() > =A0=A0=A0 # PG17+: lc_ctype/lc_collate are per-database attrs, not GUCs > =A0=A0=A0 curs.execute( > =A0=A0=A0=A0=A0=A0=A0 u"SELECT datcollate, datctype " > =A0=A0=A0=A0=A0=A0=A0 u"FROM pg_database " > =A0=A0=A0=A0=A0=A0=A0 u"WHERE datname =3D current_database()" > =A0=A0=A0 ) > =A0=A0=A0 row =3D curs.fetchone() > =A0=A0=A0 if not row: > =A0=A0=A0=A0=A0=A0=A0 _log.error(u"Could not read datcollate/datctype fo= r template DB") > =A0=A0=A0=A0=A0=A0=A0 return None > =A0=A0=A0 lc_collate, lc_ctype =3D row > =A0=A0=A0 _log.info(u'template database LC_COLLATE is [%s]', lc_collate) > =A0=A0=A0 _log.info(u'template database LC_CTYPE=A0=A0 is [%s]', lc_ctyp= e) > =A0=A0=A0 lc_ctype =3D lc_ctype.lower() >=20 > ... fixed the bug, and the bootstrapper was able to continue (until the = next error detailed below). >=20 > Explanation (textually from the LLM, I'm still a newbie to sql databases= ): In PostgreSQL 17, > lc_collate and lc_ctype were removed from pg_settings because they are n= o longer GUCs. They > are per-database attributes stored in pg_database, not cluster-wide runt= ime parameters. So > the query SELECT setting FROM pg_settings WHERE name=3D'lc_ctype' return= s zero rows, data > becomes an empty list [], and we get an IndexError which aborts the boot= strap. That is basically true. I have updated both the bootrapper and gmPG2 to work on both v17- and v17+. Best, Karsten =2D-=20 GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B