Re: Create a Foreign Table for PostgreSQL CSV Logs

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: splarv(at)ya(dot)ru, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Create a Foreign Table for PostgreSQL CSV Logs
Date: 2020-08-22 20:18:30
Message-ID: CAKFQuwasNtx0+0nWxsb-mVncHsWfAnPZHO0OR_AB_4aEhTTdfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sat, Aug 22, 2020 at 10:51 AM Bruce Momjian <bruce(at)momjian(dot)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.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2020-08-22 20:21:43 Re: Procedures
Previous Message Alvaro Herrera 2020-08-22 18:59:02 Re: Document "59.2. Built-in Operator Classes" have a clerical error?