pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: pg_dump: Remove some dead code
Date: Tue, 21 Feb 2023 22:30:54 +0100
Message-ID: <144be239-c893-9361-704f-ac85b5b98d1a@enterprisedb.com> (raw)

I have found that the per-column atttypmod tracking in pg_dump isn't 
actually used anywhere.  (The values are read but not used for writing 
out any commands.)  This is because some time ago we started formatting 
all types through format_type() on the server.  So this dead code can be 
removed.

Attachments:

0001-pg_dump-Remove-dead-code.patch (text/plain, 3.1K) download From 62d5ead1cb9166730819d0d7656ef734e99e889e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> Date: Tue, 21 Feb 2023 22:25:18 +0100 Subject: [PATCH] pg_dump: Remove dead code Client-side tracking of atttypmod has been unused since 64f3524, when server-side format_type() started being used exclusively. --- src/bin/pg_dump/pg_dump.c | 5 ----- src/bin/pg_dump/pg_dump.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 527c7651ab..1a06eeaf6a 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -8182,7 +8182,6 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) int i_attnum; int i_attname; int i_atttypname; - int i_atttypmod; int i_attstattarget; int i_attstorage; int i_typstorage; @@ -8252,7 +8251,6 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) "a.attrelid,\n" "a.attnum,\n" "a.attname,\n" - "a.atttypmod,\n" "a.attstattarget,\n" "a.attstorage,\n" "t.typstorage,\n" @@ -8320,7 +8318,6 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) i_attnum = PQfnumber(res, "attnum"); i_attname = PQfnumber(res, "attname"); i_atttypname = PQfnumber(res, "atttypname"); - i_atttypmod = PQfnumber(res, "atttypmod"); i_attstattarget = PQfnumber(res, "attstattarget"); i_attstorage = PQfnumber(res, "attstorage"); i_typstorage = PQfnumber(res, "typstorage"); @@ -8381,7 +8378,6 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) tbinfo->numatts = numatts; tbinfo->attnames = (char **) pg_malloc(numatts * sizeof(char *)); tbinfo->atttypnames = (char **) pg_malloc(numatts * sizeof(char *)); - tbinfo->atttypmod = (int *) pg_malloc(numatts * sizeof(int)); tbinfo->attstattarget = (int *) pg_malloc(numatts * sizeof(int)); tbinfo->attstorage = (char *) pg_malloc(numatts * sizeof(char)); tbinfo->typstorage = (char *) pg_malloc(numatts * sizeof(char)); @@ -8408,7 +8404,6 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) tbinfo->dobj.name); tbinfo->attnames[j] = pg_strdup(PQgetvalue(res, r, i_attname)); tbinfo->atttypnames[j] = pg_strdup(PQgetvalue(res, r, i_atttypname)); - tbinfo->atttypmod[j] = atoi(PQgetvalue(res, r, i_atttypmod)); tbinfo->attstattarget[j] = atoi(PQgetvalue(res, r, i_attstattarget)); tbinfo->attstorage[j] = *(PQgetvalue(res, r, i_attstorage)); tbinfo->typstorage[j] = *(PQgetvalue(res, r, i_typstorage)); diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index e7cbd8d7ed..cdca0b993d 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -326,7 +326,6 @@ typedef struct _tableInfo int numatts; /* number of attributes */ char **attnames; /* the attribute names */ char **atttypnames; /* attribute type names */ - int *atttypmod; /* type-specific type modifiers */ int *attstattarget; /* attribute statistics targets */ char *attstorage; /* attribute storage scheme */ char *typstorage; /* type storage scheme */ -- 2.39.2

view thread (2+ messages)  latest in thread

Message-ID: <144be239-c893-9361-704f-ac85b5b98d1a@enterprisedb.com>
Permalink:  ../144be239-c893-9361-704f-ac85b5b98d1a@enterprisedb.com/
Also on:    postgresql.org/message-id/144be239-c893-9361-704f-ac85b5b98d1a@enterprisedb.com

 ·  · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com
  Subject: Re: pg_dump: Remove some dead code
  In-Reply-To: <144be239-c893-9361-704f-ac85b5b98d1a@enterprisedb.com>
  References: <144be239-c893-9361-704f-ac85b5b98d1a@enterprisedb.com>

* 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