Re: recording of INDEX creation in tables

2022-01-21 Thread David G. Johnston
On Fri, Jan 21, 2022 at 5:39 AM Matthias Apitz wrote: > > Hello, > > Does the PostgreSQL (11.4 or 13.1) record somewhere in system tables > the creation of INDEXes (or other objects)? > > 13.1? Really? Features are not point-release dependent so v11 or v13 suffices when trying to figure out whet

Re: How are md5.h: pg_md5_hash() function and below functions working?

2022-01-21 Thread Michael Paquier
On Sat, Jan 08, 2022 at 08:12:50AM -0800, Adrian Klaver wrote: > On 1/8/22 05:21, Ali Koca wrote: >> I can't understand functions in md5.h, these are seemingly little bit >> weird. Such as: >> /* Utilities common to all the MD5 implementations, >> as of md5_common.c */ >> extern bool

Re: recording of INDEX creation in tables

2022-01-21 Thread Michael Paquier
On Fri, Jan 21, 2022 at 01:38:59PM +0100, Matthias Apitz wrote: > Does the PostgreSQL (11.4 or 13.1) record somewhere in system tables > the creation of INDEXes (or other objects)? Hard to say what you are looking for with such a general question. Would pg_index or pg_indexes be enough? There ar

Re: psql and Postgres 7.2

2022-01-21 Thread Adrian Klaver
On 1/21/22 10:49 AM, Tom Lane wrote: Adrian Klaver writes: src/bin/psql/command.c /* * Ideally we should treat the arguments as SQL identifiers. But for * backwards compatibility with 7.2 and older pg_dump files, we have to * take unquoted arguments verbatim (don't downcase them).

Re: psql and Postgres 7.2

2022-01-21 Thread Tom Lane
Adrian Klaver writes: > src/bin/psql/command.c > /* >* Ideally we should treat the arguments as SQL identifiers. But for >* backwards compatibility with 7.2 and older pg_dump files, we have to >* take unquoted arguments verbatim (don't downcase them). For now, >* double-quoted arg

Re: Using a different column name in a foreign table

2022-01-21 Thread David G. Johnston
On Fri, Jan 21, 2022 at 11:32 AM Alanoly Andrews wrote: > Thanks Adrian. I was aware of that. > > But...in the case of FT definition, the quotes are mandatory after > column_name in options. And it is a single quote. > Using an unqualified "quote" is this kind of discussion should be avoided. T

Re: Using a different column name in a foreign table

2022-01-21 Thread Adrian Klaver
On 1/21/22 10:32 AM, Alanoly Andrews wrote: Thanks Adrian. I was aware of that. But...in the case of FT definition, the quotes are mandatory after column_name in options. And it is a single quote. The problem here may be is that the "create foreign table" statement accepts only lower case aft

Re: Using a different column name in a foreign table

2022-01-21 Thread Tom Lane
Alanoly Andrews writes: > But...in the case of FT definition, the quotes are mandatory after > column_name in options. And it is a single quote. Right. That string literal is not case-folded, so it has to accurately match the actual spelling of the remote column name. Anything else we might do

psql and Postgres 7.2

2022-01-21 Thread Adrian Klaver
In answering a question on SO I discovered this: \l PRODUCTION List of databases Name| Owner | Encoding | Collate |Ctype| Access privileges +--+--+-+-+--- production | pos

RE: Using a different column name in a foreign table

2022-01-21 Thread Alanoly Andrews
Thanks Adrian. I was aware of that. But...in the case of FT definition, the quotes are mandatory after column_name in options. And it is a single quote. The problem here may be is that the "create foreign table" statement accepts only lower case after options. Remember that the double quotes fo

Re: Using a different column name in a foreign table

2022-01-21 Thread Adrian Klaver
On 1/21/22 10:04 AM, Alanoly Andrews wrote: Following up on my previous message, there was a related problem with FT definitions for which I have a workaround. It seems that the new column_name after "options" in an FT definition cannot be in upper case. See below: When I define a foreign table

Re: Can commands be typed in to view geometry in PgAdmin?

2022-01-21 Thread Ron
pgAdmin, as the name implies, is really for *administering* Postgresql in a GUI manner, *not* for visualizing GIS coordinates. On 1/21/22 10:26 AM, Shaozhong SHI wrote: It would be nice to be able to write lines of scripts to tell PgAdmin to show some visualisation of geographical features. R

RE: Using a different column name in a foreign table

2022-01-21 Thread Alanoly Andrews
Following up on my previous message, there was a related problem with FT definitions for which I have a workaround. It seems that the new column_name after "options" in an FT definition cannot be in upper case. See below: When I define a foreign table like below, I get an error in the subsequent

Re: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?

2022-01-21 Thread Tom Lane
Dominique Devienne writes: > On Fri, Jan 21, 2022 at 5:47 PM Tom Lane wrote: >> There is a notion of "custom plans" in which parameter values are >> inserted as constants, precisely to allow simplifications based on >> known constant values. But this particular case isn't implemented. > Where c

Re: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?

2022-01-21 Thread Dominique Devienne
On Fri, Jan 21, 2022 at 5:47 PM Tom Lane wrote: >> Dominique Devienne writes: > > Will the query planner be able to *peek* into the args, and turn `colN like > > $N` into a no-op? Thanks for the replies, David and Tom. > No. It would not do that even if the pattern were constant '%'; > it doe

RE: Using a different column name in a foreign table

2022-01-21 Thread Alanoly Andrews
Thanks Tom, Guillaume and Adrian. My mistake in reversing the order of name and newname in the definition. After the switch, it works. ButI'm investigating another environment where the definition appears to have been correct and yet there is an error in select. Maybe I'll post again later,

Re: Using a different column name in a foreign table

2022-01-21 Thread Tom Lane
Alanoly Andrews writes: > I see that the syntax for the creation of a foreign table allows you to use a > column name in the FT that is different from the one in the base table. Such > a "create foreign table" statement executes successfully and creates the FT. > But when I query the FT, I get

Re: Can commands be typed in to view geometry in PgAdmin?

2022-01-21 Thread David G. Johnston
On Fri, Jan 21, 2022 at 9:26 AM Shaozhong SHI wrote: > It would be nice to be able to write lines of scripts to tell PgAdmin to > show some visualisation of geographical features. > I wasn't aware pgAdmin had a command line oriented interface. I thought it was pure GUI. The only scripts you wr

Re: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?

2022-01-21 Thread Tom Lane
Dominique Devienne writes: > Will the query planner be able to *peek* into the args, and turn the > `colN like $N` > into a no-op? No. It would not do that even if the pattern were constant '%'; it doesn't know that much about that particular function. There is a notion of "custom plans" in whi

Re: Using a different column name in a foreign table

2022-01-21 Thread Guillaume Lelarge
Hi, Le ven. 21 janv. 2022 à 17:24, Alanoly Andrews a écrit : > Hello, > > I see that the syntax for the creation of a foreign table allows you to > use a column name in the FT that is different from the one in the base > table. Such a "create foreign table" statement executes successfully and >

Re: Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?

2022-01-21 Thread David G. Johnston
On Fri, Jan 21, 2022 at 9:36 AM Dominique Devienne wrote: > > for the various cases of empty argN strings, or does the planner do > *bind-peeking*, and thus a single prepared statement would do the job, > and still have different plans used depending on the actual binds? > > I'm assuming PostgreS

Does PostgreSQL do bind-peeking? Is `col like '%'` optimized-away by the planner?

2022-01-21 Thread Dominique Devienne
Hi, I just saw some code of ours that takes 4 strings are arguments, and wants to do optional filtering on those, in a SELECT statement. Something like: ``` void foo(string arg1, string arg2, ...) { ... = exec( conn, "SELECT * from tab where col1 like $1 and col2 like $2 and ...",

Re: Using a different column name in a foreign table

2022-01-21 Thread Adrian Klaver
On 1/21/22 08:24, Alanoly Andrews wrote: Hello, I see that the syntax for the creation of a foreign table allows you to use a column name in the FT that is different from the one in the base table. Such a "create foreign table" statement executes successfully and creates the FT. But when I que

Re: Query on postgres_fdw extension

2022-01-21 Thread Shaozhong SHI
Any functional code to be tested to confirm? Regards, David On Fri, 21 Jan 2022 at 15:55, Laurenz Albe wrote: > On Fri, 2022-01-21 at 14:33 +, Duarte Carreira wrote: > > If we just create the 2 foreign tables, one complete and one without id, > > you can simply insert into the table withou

Re: Can commands be typed in to view geometry in PgAdmin?

2022-01-21 Thread Shaozhong SHI
It would be nice to be able to write lines of scripts to tell PgAdmin to show some visualisation of geographical features. Regards, David On Fri, 21 Jan 2022 at 15:14, David G. Johnston wrote: > It is amazing how much one can learn by reading documentation. You are > looking for a section tha

Using a different column name in a foreign table

2022-01-21 Thread Alanoly Andrews
Hello, I see that the syntax for the creation of a foreign table allows you to use a column name in the FT that is different from the one in the base table. Such a "create foreign table" statement executes successfully and creates the FT. But when I query the FT, I get an error wrt to the colum

Re: Query on postgres_fdw extension

2022-01-21 Thread Laurenz Albe
On Fri, 2022-01-21 at 14:33 +, Duarte Carreira wrote: > If we just create the 2 foreign tables, one complete and one without id, > you can simply insert into the table without id and it will work fine. > To select and show data, you use the "complete" table that has the id column. > > No need

Re: proj_create errors in EDB 13.5 installation macOS

2022-01-21 Thread Paul Ramsey
> On Jan 21, 2022, at 4:45 AM, Moen, Paul T. wrote: > > I am seeing the following errors in my PostgreSQL log files and wonder if > this is a problem with EDB's installation. Yes, missing the proj.db would certainly make proj unhappy. Search your system first and see if the file is actuall

Re: Can commands be typed in to view geometry in PgAdmin?

2022-01-21 Thread David G. Johnston
It is amazing how much one can learn by reading documentation. You are looking for a section that describes how to view, and possibly edit, data in pgAdmin4. David J. On Fri, Jan 21, 2022 at 5:52 AM Shaozhong SHI wrote: > I just wonder whether commands can be typed in PgAdmin to view geometri

Re: Query on postgres_fdw extension

2022-01-21 Thread Duarte Carreira
Hmmm... I don't think a view or trigger are necessary. If we just create the 2 foreign tables, one complete and one without id, you can simply insert into the table without id and it will work fine. To select and show data, you use the "complete" table that has the id column. No need for trigger

Re: [EXT] Re: Can we get the CTID value

2022-01-21 Thread Laurenz Albe
On Thu, 2022-01-20 at 17:00 +, Garfield Lewis wrote: > I need the page and possibly row of the data location to be stored as an > element > of the new type. This is to simulate a structure from another database system. As I said, that is impossible. Again, describe with many, many words what

Re: Query on postgres_fdw extension

2022-01-21 Thread Laurenz Albe
On Thu, 2022-01-20 at 15:59 +, Duarte Carreira wrote: > I got here after encountering the same difficulty, although on a much more > mundane scenario. > > I'm used to fdw on a read-only basis. I was just inserting a new record on a > foreign table > and got blocked... and after much searchin

Can commands be typed in to view geometry in PgAdmin?

2022-01-21 Thread Shaozhong SHI
I just wonder whether commands can be typed in PgAdmin to view geometries. Regards, David

proj_create errors in EDB 13.5 installation macOS

2022-01-21 Thread Moen, Paul T.
I am seeing the following errors in my PostgreSQL log files and wonder if this is a problem with EDB's installation. proj_create: Cannot find proj.db proj_create: no database context specified proj_create: Cannot find proj.db proj_create: no database context specified proj_create: Cannot find pro

Fwd: PgAdmin is struggling and can we configure it so that it works better

2022-01-21 Thread Tomas Pospisek
Forgot to include pgsql-general@lists.postgresql.org in the Cc... Forwarded Message Subject: Re: PgAdmin is struggling and can we configure it so that it works better Date: Fri, 21 Jan 2022 13:42:13 +0100 From: Tomas Pospisek To: Shaozhong SHI On 21.01.22 12:42, Shaozhong

recording of INDEX creation in tables

2022-01-21 Thread Matthias Apitz
Hello, Does the PostgreSQL (11.4 or 13.1) record somewhere in system tables the creation of INDEXes (or other objects)? Thanks matthias -- Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub August 13, 1961: Bet

Re: SQL questiom

2022-01-21 Thread Jacob Bunk Nielsen
haman...@t-online.de writes: > I am using a query pretty often that looks like > SELECT <> WHERE <> AND > <> > > Is there a way (with sql or plpgsql) to convert that into > SELECT myquery('<>') I would solve that by creating a view like: CREATE VIEW some_view_name AS SELECT <> WHERE <>; See

Re: Query on postgres_fdw extension

2022-01-21 Thread Duarte Carreira
Thanks for your help! I'm not going forward with the id generating scheme... I prefer to let the bd do that work on its own. Sharding is way over my head. For now I just created the 2 tables, one for inserting (without the id column), another for everything else. It's awkward and prone to human er

PgAdmin is struggling and can we configure it so that it works better

2022-01-21 Thread Shaozhong SHI
Some time, PgAdmin freezes and its response is very slow. Some time, it gives strange display of table content. Perhaps, it is related to the fact that PgAdmin is struggling with the amount of data it thinks that it has to display. I just wonder whether we can configure PgAdmin so that it will w

Re: SQL questiom

2022-01-21 Thread Thomas Boussekey
Le ven. 21 janv. 2022 à 11:14, a écrit : > > > Hi, > > I am using a query pretty often that looks like > SELECT <> WHERE <> AND > <> > > Is there a way (with sql or plpgsql) to convert that into > SELECT myquery('<>') > > Kind regards > Wolfgang Hamann > > > > Hello Wolfgang, You can use a FUNC

SQL questiom

2022-01-21 Thread hamann . w
Hi, I am using a query pretty often that looks like SELECT <> WHERE <> AND <> Is there a way (with sql or plpgsql) to convert that into SELECT myquery('<>') Kind regards Wolfgang Hamann