Re: Example not producing shown output

2019-11-27 Thread Daniel Gustafsson
> On 26 Nov 2019, at 19:28, Alvaro Herrera  wrote:

> Or perhaps we can add a second line in the example cell for the
> @@ operator, to make it clear that both forms can be used.  Users can be
> expected to apply some intuition from that point onwards.

Wouldn't it be more intuitive to add such a second line under to_tsvector, or
expand the Description field to cover a brief discussion covering this? 

cheers ./daniel




document effect of USAGE on foreign server to dblink

2019-11-27 Thread Jeff Janes
I think that the permissions around the usage of foreign server names as
connection names in dblink should be documented, as in the attached.

Also, for dblink itself it says "It is recommended to use the foreign-data
wrapper dblink_fdw when defining the foreign server".  Is there a reason
for this recommendation?  postgres_fdw seems to work fine on the surface,
is there some hidden trap in using it?

Cheers,

Jeff


server_dblink_priv.patch
Description: Binary data


COPY manual is ambiguous about column list

2019-11-27 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/sql-copy.html
Description:

"If a list of columns is specified, COPY will only copy the data in the
specified columns to or from the file. If there are any columns in the table
that are not in the column list, COPY FROM will insert the default values
for those columns."

I clearly see "to or from" file here. But if one tries to COPY FROM filename
with more columns than list specified, the process fails:

```
pasha@PG480 MINGW64 ~
$ echo "col1,col2,col3" > test.csv

pasha@PG480 MINGW64 ~
$ cat test.csv
col1,col2,col3

pasha@PG480 MINGW64 ~
$ psql -d migrator

migrator=# CREATE TABLE copy_test(col1 text, col2 text);
CREATE TABLE

migrator=# COPY copy_test(col1, col2) FROM 'test.csv' (FORMAT csv);
ERROR:  extra data after last expected column
CONTEXT:  COPY copy_test, line 1: "col1,col2,col3"
```

I believe this statement should be rewritten, e.g.
"If a list of columns is specified, COPY will only copy the data in the
specified columns to the file. The input file should contain the same number
of columns as the list specified, otherwise COPY FROM will fail. One may use
`awk` to preprocess the input file and remove extra columns. If there are
any columns in the table that are not in the column list, COPY FROM will
insert the default values for those columns."

https://www.postgresql.org/docs/12/sql-copy.html