Xojo 2019r3.1 + PostgreSQL 12 at mac and the pg_hba.conf

hi,

i installed PostgreSQL 12 at mac mini and i will connect from my windows pc with a xojo app.
first error was
FATAL: no pg_hba.conf entry for host “192.168.178.35”, user “software”, database “markus”, SSL off

please can give someone me a working configuration pg_hba.conf tip?
that Xojo work and pgAdmin4 too.

www.postgresql.org/docs/10/auth-pg-hba-conf.html

after edit pg_hba.conf and postgresql.conf to ssl = off it seems the server is not anymore running^^

it seems that TextEdit break the config files^^

TextEdit seems not to change line breaks.

i copied the original config files over and the server sees not running after a reboot :frowning:
can not connect with pgAdmin Tool

In the data directory, make sure there is no “postmaster.pid” file. That file will keep PostgreSQL from starting up after a reboot.

Did you restore the default pg_hba.conf file and make sure the permissions are right?

1 Like

that postmaster.pid appear for a second and disappear in interval of 5 seconds.

before i changed something i used copy / paste for pg_hba.conf & postgresql.conf
seems after copy it back it have other permissions … arrgg
i add postgree user for this files and i think the server is running now.

That’s normal for the postmaster file.

So where are you now?

pgAdmin works again, but i need to connect from other pc with a xojo app.
the distance between both pcs are 50cm on same desktop.

my connect hang here

FATAL: no pg_hba.conf entry for host “192.168.178.35”, user “software”, database “markus”, SSL off

support pg_hba.conf a server name too instead of a ip?

i add this row and now i can connect :slight_smile:

host all all 0.0.0.0/0 md5

(after edit i used the Reload Configuration Tool in Launchpad.)

You just made the database universally accessible to the world, I think.

1 Like

yes but my router is before :wink:

now i change the table user to “software” and now the columns are read only^^ arrrgg
can not input test data in pgAdmin …

host all all 192.168.178.0/24 md5
would have been a cleaner solution !

1 Like

i used the hostname first and thought it works but seems not, only IP
.0 means all from 0 to 255, or?

other pc’s should also have access in local network.

managing a PostgreSQL database is very annoying.
it there a way to not write public.“Table1” ? just Table1 in the query?

/24 tells to use a mask of 255.255.255.0
so all IP of the same class

1 Like

how can i input data here ???

i recreated the database and let all default owner postgre.
the id is a auto increment field.

during the day i swear i can input something there …

… it need a pk field … then the new input row appear

about quotes in querys i found this answer!

I created table objects using pgAdmin and i wrote table name and column names uppercased. pgAdmin created query with quotas - because of the names was uppercased. So query had to be written with quotas.

What the hell …?

pgAdmin 4 on mac
after insert a new column with pk the input row is there.

that seem to be a limitation of the GUI data grid editor in pgAdmin. You can insert data without a PK by other means, if you like.

sure, if public is in your search_path (which it is by default), you can specify just "Table1". The quotes are mandatory as long as the table has a name that does not comply with the usual naming rules of an identifier: [a-z_][a-z0-9_]* . Internally, all non-quoted identifiers are converted to lower case, so AbC is just an alias of abc as is aBc but different to "Abc". pgAdmin again ‘helps’ here by quoting the table name in the CREATE TABLE statement if you use the GUI and enter an titlecased name.
See here: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

1 Like

you can do that even easier w/o specifying the network by using a samenet rule:
host all all samenet md5
with that, all hosts on the networks the server is itself listing to (see listen_addresses parameter in postgresql.conf) will be allowed to connect as all users to all databases without SSL identified by an hashed password.

have a look to the listen_addresses GUC mentioned before. It often default to localhost meaning the server does only listen on the loopback interface and is therefore not accessible from other hosts at all.

it does, but you need a working reverse lookup (PTR) DNS configuration for this to work.

2 Likes

Valentina Studio behave same … but now i can input test data in both.

thank you for the informative notes :slight_smile:

the naming rules are very stupid and i like Pascal Casing but i not want this quotes in the query.

this rule is better for me because i use also network over power line devices.

These ‘stupid’ rules are required by the SQL standard (handy grammar excerpt), dating back at least till SQL-92 (Quote from a draft of the standard):

         4) An <SQL language identifier> is equivalent to an <SQL language
            identifier> in which every letter that is a lower-case letter
            is replaced by the equivalent upper-case letter or letters. This
            treatment includes determination of equivalence, representation
            in the Information and Definition Schemas, representation in the
            diagnostics area, and similar uses.

You can absolutely use “Pascal Casing” in your queries:

CREATE TABLE MyTable (PascalCaseID INTEGER);
INSERT INTO MYTABLE (pascalcaseID) VALUES (42);

both statements will operate on a field mytable.pascalcaseid (downfolded as identifiers are not quoted). The behaviour of PostgreSQL to downfold identifiers instead of upfolding them as mentioned in the standard is just an implementation detail, the required equivalence is given nevertheless.

1 Like

ok, that sounds good.
in ms sql i can use Pascal Casing at design with few exceptions. (reserved words need brackets in query.)

i used show search_path
it show “$user”, public

my issue was this Uppercase thing at Table Design.
i used Table1 in query then i got an error then i changed it to public.Table1 got error then to public.“Table1”
but now i can just use Table1 if the schema table name is table1