Re: Suggestion to standardize comment format in pg_dump

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: Suggestion to standardize comment format in pg_dump
Дата
Msg-id 507163ed-e23a-4ac0-9017-646dbb7b9de8@app.fastmail.com
обсуждение исходный текст
Ответ на Suggestion to standardize comment format in pg_dump  (Nohez Poonawala <nohezp@gmail.com>)
Ответы Re: Suggestion to standardize comment format in pg_dump
Список pgsql-hackers
On Wed, Dec 11, 2024, at 3:37 AM, Nohez Poonawala wrote:
Currently, the pg_dump tool outputs comments in different formats for
primary/foreign keys and indexes.  Below is the comment format.

- for Primary key:
  -- Name: TABLENAME CONSTRAINTNAME; Type: CONSTRAINT; Schema: SCHEMA;
Owner: OWNER
- for Foreign key:
  -- Name: TABLENAME CONSTRAINTNAME; Type: FK CONSTRAINT; Schema:
SCHEMA; Owner: OWNER
- for Index:
  -- Name: INDEXNAME; Type: INDEX; Schema: SCHEMA; Owner: OWNER

To maintain consistency, I suggest modifying the comment format for
indexes to include the associated TABLENAME, similar to constraints.

For example:
- for Index:
  -- Name: TABLENAME INDEXNAME; Type: INDEX; Schema: SCHEMA; Owner: OWNER

This small change would improve clarity and make the output format more uniform.

Constraints and indexes are different classes of objects. Per SQL standard,
different tables can have same constraint names. However, different tables
cannot have same index name (SQL standard says nothing about indexes. That's a
Postgres implementation detail.) Having said that, you don't need the table
name to associate it with an index (because it is unique in a schema) but a
constraint requires a table (because there might be multiple constraints with
the same name in a schema).  An argument against this inclusion is that it will
increase the output file size without adding a crucial information. You mention
consistency but since it is a different class of objects I don't think this
argument holds much water.


--
Euler Taveira

В списке pgsql-hackers по дате отправления: