Score:0

Using PostgreSQL 12.12 pg_ commands in Ubuntu 20.04 not working

to flag

I've installed PostGreSQL 12.12 with:

sudo apt install postgresql postgresql-contrib libpq-dev

But I'm seeing errors with pg_ commands. For example, this is the error when trying to setup replication:

postgres-# pg_create_physical_replication_slot wallinfo, immediately_reserve true, temporary true;  
ERROR:  syntax error at or near "pg_create_physical_replication_slot"

LINE 1: pg_create_physical_replication_slot wallinfo, immediately_re...  
       ^  
The error is the first letter p from pg_

What can I do to enable the pg_ commands.

I've checked:

> whereis ruby
ruby: /usr/bin/ruby2.7 /usr/bin/ruby /usr/lib/x86_64-linux-gnu/ruby /usr/lib/ruby /usr/share/man/man1/ruby.1.gz

But I'm still encounter errors when using the pg_ commands in psql.

in flag
Replication is typically configured by editing the `postgresql.conf` and `pg_hba.conf` files. Are you trying to build a very specific sort of replication?
ronald avatar
to flag
postgresql.conf and pg_hba.conf is needed for communication, to setup the WAL files I need to configure the database to make things possible
in flag
Ah, I see what you're doing now. Those `pg_` objects are functions, so you need to wrap them in a `SELECT`. For example: `SELECT * FROM pg_create_physical_replication_slot('standby1_slot');`
ronald avatar
to flag
@matigo the official command is pg_create_physical_replication_slot(slot_name name [, immediately_reserve boolean, temporary boolean]) as input I changed the line to pg_create_physical_replication_slot (slot_name wallinfo, immediately_reserve true, temporary true); stil the error point to the p from pg_
ronald avatar
to flag
The answer is that pg_create is not present in the /usr/lib/postgresql/12/main directory and therefore can't be executed.
Score:-1
to flag

The answer is that pg_create is not present in the /usr/lib/postgresql/12/main directory and therefore can't be executed.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.