Re: Attaching database

2022-10-14 Thread Julien Rouhaud
Hi, On Fri, Oct 14, 2022 at 11:16:44PM -0500, Igor Korot wrote: > > Sorry for resurrecting this old thread... > If an attaching the DB creates new connection which will be cmpletely > independent - how the INFORMATION_SCHEMA.table@table_catalog > field is handled. > > Lets say I open connection to

Re: Attaching database

2022-10-14 Thread David G. Johnston
On Fri, Oct 14, 2022 at 9:47 PM Igor Korot wrote: > > Making catalog current means switching between DBs. > Remember initially I connected to (finance) DB, which made the (finance) > catalog > current. > Then I "opened a second connection" to (finance_2021), which made > that current catalog and

Re: Attaching database

2022-10-14 Thread Igor Korot
Hi, David et al, On Fri, Oct 14, 2022 at 11:39 PM David G. Johnston wrote: > > On Fri, Oct 14, 2022 at 9:17 PM Igor Korot wrote: >> >> Hi, guys, >> >> On Sun, Oct 25, 2020 at 1:27 PM Peter J. Holzer wrote: >> > >> > On 2020-10-19 20:21:05 +0200, Pavel Stehule wrote: >> >> > In case this isn't c

Re: Attaching database

2022-10-14 Thread David G. Johnston
On Fri, Oct 14, 2022 at 9:17 PM Igor Korot wrote: > Hi, guys, > > On Sun, Oct 25, 2020 at 1:27 PM Peter J. Holzer wrote: > > > > On 2020-10-19 20:21:05 +0200, Pavel Stehule wrote: > > > In case this isn't clear: > > > > It is the server (or more specifically, the foreign data wrapper) which > >

Re: Attaching database

2022-10-14 Thread Igor Korot
Hi, guys, On Sun, Oct 25, 2020 at 1:27 PM Peter J. Holzer wrote: > > On 2020-10-19 20:21:05 +0200, Pavel Stehule wrote: > > po 19. 10. 2020 v 20:18 odesílatel Igor Korot napsal: > > On Mon, Oct 19, 2020 at 12:51 PM Pavel Stehule > > wrote: > > > It is a different thing - postgresql_

Re: Zheap Tech Problem

2022-10-14 Thread Michael Paquier
On Fri, Oct 14, 2022 at 07:53:17PM -0700, Adrian Klaver wrote: > On 10/14/22 18:59, jacktby wrote: >> What's Zheap tech? Can you give me some details or stuff to study? and >> which version will be realized in ? There are a few videos on youtube that can provide some insight about all that, mainly

Re: Zheap Tech Problem

2022-10-14 Thread Adrian Klaver
On 10/14/22 18:59, jacktby wrote: What's Zheap tech? Can you give me some details or stuff to study? and which version will be realized in ? 1) Go to search engine of choice. 2) Enter zheap 3) Pick a link from something like: https://duckduckgo.com/?t=ffsb&q=zheap&ia=web jacktby

Zheap Tech Problem

2022-10-14 Thread jacktby
What's Zheap tech? Can you give me some details or stuff to study? and which version will be realized in ? jacktbyjack...@gmail.com

Re: Where to flag an issue with EDB's PG15 Windows installer?

2022-10-14 Thread Adrian Klaver
On 10/14/22 14:45, Anthony DeBarros wrote: Hi, Where is the appropriate place to file a concern/issue with the EDB installer -- StackBuilder in particular -- for PostgreSQL 15 on Windows? The installer is maintained by EDB so they will need to be notified. Your choices: 1) From here: http

Re: How to return argument data type from sql function

2022-10-14 Thread Tom Lane
Andrus writes: > How to change this query so that it searches schemas in set search_path > order and returns column width from it ? In this case p_namespace > parameter can removed. I showed you that already: regclass will take care of it. regards, tom lane

Re: How to return argument data type from sql function

2022-10-14 Thread David G. Johnston
On Fri, Oct 14, 2022 at 2:56 PM Andrus wrote: > select torus(charcol) :: CHAR( ColWidth('public', 'test', 'charcol') ) > from test > > This throws error in Postgres. ColWidth is immutable and called with > constant arguments so it should work. How to fix postgres to allow constant > ColWidth()

Re: How to return argument data type from sql function

2022-10-14 Thread Andrus
> Adrian Klaver recommends in https://stackoverflow.com/questions/74061290/how-to-return-argument-datatype-from-sql-function#comment130780708_74061290 at this worked. In this best solution? Padding a text typed output with actual significant spaces "works"? It is not equivalent to a

Re: How to return argument data type from sql function

2022-10-14 Thread Andrus
Hi! >Yeah, you could do that if you have the column information at hand. Personally I'd also throw in "... and atttypid = 'bpchar'::regtype", because that atttypmod calculation will give you garbage for types other than bpchar and varchar. I added this: create or replace function public.ColWi

Where to flag an issue with EDB's PG15 Windows installer?

2022-10-14 Thread Anthony DeBarros
Hi, Where is the appropriate place to file a concern/issue with the EDB installer -- StackBuilder in particular -- for PostgreSQL 15 on Windows? Thanks, Anthony DeBarros

Re: How to return argument data type from sql function

2022-10-14 Thread David G. Johnston
On Fri, Oct 14, 2022 at 2:00 PM Andrus wrote: > I tried > > create or replace FUNCTION torus(eevarus bpchar) returns bpchar immutable > AS $f$ > select translate( $1, U&'\00f8\00e9', U&'\0451\0439' ); > $f$ LANGUAGE SQL ; > > but it still returns result without trailing spaces. So it is not worki

Re: How to return argument data type from sql function

2022-10-14 Thread Tom Lane
Andrus writes: > I tried > create or replace FUNCTION torus(eevarus bpchar) returns bpchar > immutable AS $f$ > select translate( $1, U&'\00f8\00e9', U&'\0451\0439' ); > $f$ LANGUAGE SQL ; > but it still returns result without trailing spaces. So it is not working. As I said, width constraints

Re: How to return argument data type from sql function

2022-10-14 Thread Andrus
Hi! Making separate functions for text and bpchar works for me. regression=# select pg_typeof(torus(f1)) from char_tbl; pg_typeof --- character I tried create or replace FUNCTION torus(eevarus bpchar) returns bpchar immutable AS $f$ select translate( $1, U&'\00f8\00e9', U&'\0451

Re: Number of updated rows with LibPQ

2022-10-14 Thread Dominique Devienne
On Fri, Oct 14, 2022 at 4:39 PM Daniel Verite wrote: > Or a SELECT, or an UPDATE RETURNING, or a DELETE RETURNING. > The code still need to look at PQcmdStatus() to learn which kind it is, Thanks Daniel. This is exactly what I needed. --DD PS: Now I wonder whether PQcmdTuples() points to the sam

Re: [libpq] OIDs of extension types? Of custom types?

2022-10-14 Thread Dominique Devienne
On Fri, Oct 14, 2022 at 4:35 PM Tom Lane wrote: > > I don't. I used > > https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat > > They're stable Good to know, thanks. > but writing magic numbers leads to unreadable code. > Use the macros from catalog/pg_type_d.h. OK.

Re: How to return argument data type from sql function

2022-10-14 Thread Tom Lane
Andrus writes: > PostgreSQL 12.2+ function is defined as >     create FUNCTION torus(eevarus text) returns text immutable AS $f$ > select translate( $1, U&'\00f8\00e9', U&'\0451\0439' ); >     $f$ LANGUAGE SQL ; > if char(n) column is passed as argument, torus() should also return > char

Re: Number of updated rows with LibPQ

2022-10-14 Thread Daniel Verite
Laurenz Albe wrote: > > Or is there a libpq API on PGresult that would allow to get the type > > of statement the result is from? > > The command tag is not what you look at. Yet that's what psql does. from PrintQueryResult(): /* if it's INSERT/UPDATE/DELETE RETURNING, also prin

Re: [libpq] OIDs of extension types? Of custom types?

2022-10-14 Thread Tom Lane
Dominique Devienne writes: > On Fri, Oct 14, 2022 at 2:31 PM Laurenz Albe wrote: >> You use the #defines like TEXTOID for the built-in Oids, right? > I don't. I used > https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat > as a reference. > I suspect that should be fa

Re: [libpq] OIDs of extension types? Of custom types?

2022-10-14 Thread Dominique Devienne
On Fri, Oct 14, 2022 at 2:31 PM Laurenz Albe wrote: > You use the #defines like TEXTOID for the built-in Oids, right? I don't. I used https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat as a reference. I suspect that should be fairly stable, right? I have at least 2 o

Re: does postgres has snapshot standby feature?

2022-10-14 Thread Christoph Moench-Tegeder
## milist ujang (ujang.mil...@gmail.com): > read about removing standby.signal file behavior in pg14 from > https://dbaclass.com/article/how-to-open-postgres-standby-database-for-read-writesnapshot-standby/ That article is fractally wrong, and that starts right in the first sentence. See https://

Re: does postgres has snapshot standby feature?

2022-10-14 Thread Laurenz Albe
On Fri, 2022-10-14 at 16:20 +0700, milist ujang wrote: > read about removing standby.signal file behavior in pg14 from  > https://dbaclass.com/article/how-to-open-postgres-standby-database-for-read-writesnapshot-standby/ > > I was shocked about the hidden feature of snapshot standby, does it reall

Re: [libpq] OIDs of extension types? Of custom types?

2022-10-14 Thread Laurenz Albe
On Fri, 2022-10-14 at 13:39 +0200, Dominique Devienne wrote: > Hi. I'm using binary binds and results for DMLs, as well as for COPY. > > So far, I've stayed within built-in scalar and array types, thus I > could hardcode the OIDs of values "in the type-system" (in C++, via > traits). > But I'd lik

Re: Number of updated rows with LibPQ

2022-10-14 Thread Laurenz Albe
On Fri, 2022-10-14 at 13:52 +0200, Dominique Devienne wrote: > On Wed, Oct 5, 2022 at 8:17 PM Tom Lane wrote: > > Laurenz Albe writes: > > > On Wed, 2022-10-05 at 16:38 +0200, Dominique Devienne wrote: > > > Yes, you have to use PQcmdTuples(), and you have to convert the string to > > > an integ

Re: Number of updated rows with LibPQ

2022-10-14 Thread Guillaume Lelarge
Le ven. 14 oct. 2022 à 13:52, Dominique Devienne a écrit : > On Wed, Oct 5, 2022 at 8:17 PM Tom Lane wrote: > > Laurenz Albe writes: > > > On Wed, 2022-10-05 at 16:38 +0200, Dominique Devienne wrote: > > > Yes, you have to use PQcmdTuples(), and you have to convert the string > to an integer. >

Re: Number of updated rows with LibPQ

2022-10-14 Thread Dominique Devienne
On Wed, Oct 5, 2022 at 8:17 PM Tom Lane wrote: > Laurenz Albe writes: > > On Wed, 2022-10-05 at 16:38 +0200, Dominique Devienne wrote: > > Yes, you have to use PQcmdTuples(), and you have to convert the string to > > an integer. > > But don't worry: the result will *not* be "INSERT 0 5", it will

[libpq] OIDs of extension types? Of custom types?

2022-10-14 Thread Dominique Devienne
Hi. I'm using binary binds and results for DMLs, as well as for COPY. So far, I've stayed within built-in scalar and array types, thus I could hardcode the OIDs of values "in the type-system" (in C++, via traits). But I'd like to venture into extension (e.g. hstore) and custom (enums, domain, etc.

Re: recovery.conf and archive files

2022-10-14 Thread Rita
is the archive command even needed? I can see my standby fully synced. On Fri, Oct 14, 2022 at 5:27 AM Guillaume Lelarge wrote: > Le jeu. 13 oct. 2022 à 12:42, Rita a écrit : > >> The primary's recovery.conf looks like this >> >> listen_address='*' >> wal_level=replica >> synchronous_commit=loc

Re: recovery.conf and archive files

2022-10-14 Thread Guillaume Lelarge
Le jeu. 13 oct. 2022 à 12:42, Rita a écrit : > The primary's recovery.conf looks like this > > listen_address='*' > wal_level=replica > synchronous_commit=local > archive_move = on > archive_command = 'cp %p /var/lib/pgsql/11/data/archive/%f' > max_wal_senders = 10 > wal_keep_segments=10 > synchr

does postgres has snapshot standby feature?

2022-10-14 Thread milist ujang
hi all, read about removing standby.signal file behavior in pg14 from https://dbaclass.com/article/how-to-open-postgres-standby-database-for-read-writesnapshot-standby/ I was shocked about the hidden feature of snapshot standby, does it really exist? I could not find anything about snapshot stand

How to return argument data type from sql function

2022-10-14 Thread Andrus
PostgreSQL 12.2+ function is defined as     create FUNCTION torus(eevarus text) returns text immutable AS $f$ select translate( $1, U&'\00f8\00e9', U&'\0451\0439' );     $f$ LANGUAGE SQL ; This function is called as CHAR(n) or text columns like     create temp table test (     charcol char