Re: Create a Foreign Table for PostgreSQL CSV Logs - Mailing list pgsql-docs

From David G. Johnston
Subject Re: Create a Foreign Table for PostgreSQL CSV Logs
Date
Msg-id CAKFQuwasNtx0+0nWxsb-mVncHsWfAnPZHO0OR_AB_4aEhTTdfA@mail.gmail.com
Whole thread Raw
In response to Re: Create a Foreign Table for PostgreSQL CSV Logs  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Create a Foreign Table for PostgreSQL CSV Logs  (Олег Самойлов <splarv@ya.ru>)
List pgsql-docs
On Sat, Aug 22, 2020 at 10:51 AM Bruce Momjian <bruce@momjian.us> wrote:
On Fri, Aug 21, 2020 at 08:41:54PM -0700, David G. Johnston wrote:
> Adding CHECK constraints and --
> comments to the CREATE TABLE command would be a welcome addition.  In
> particular I noticed:
>
> paragraph: client host:port number
> example: connection_from text,
>
> could become:
>
> connection_from text check(connection_from ~ '^[^:]+:[0-9]+$) -- the host and
> port of the client, colon-separated

> I may pick this up in the future unless someone thinks it wouldn't be a good
> idea.  I would be removing the paragraph of field names and make the table
> specification authoritative.

I am a little worried about adding this since the data is generated in
an automated way, and might change, or some config value might change
its format.  I think the example is to show how to load, and adding extra
constraints would just detract from the illustration, I think.

Good constraints wouldn't include specific values, just general structure when appropriate.  The existing documentation already does this in the provided example - though relegating things to just comments would still be an improvement.  I see it less as an illustration in the Config section and more of a specification.  A config value changing its format is going to be something anyone using this example would have to understand and adapt to - it still seems worthwhile to have it fleshed out for the default.

The middle of the config section doesn't seem like a great place to teach that the COPY command exists.

David J.

pgsql-docs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Document "59.2. Built-in Operator Classes" have a clerical error?
Next
From: "David G. Johnston"
Date:
Subject: Re: Procedures