Jump to content
#StayAtHome ×

NotionCommotion

Members
  • Content Count

    2,023
  • Joined

  • Last visited

  • Days Won

    9

NotionCommotion last won the day on July 2 2019

NotionCommotion had the most liked content!

Community Reputation

30 Good

About NotionCommotion

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ah, I interpreted "connection refused" as actively having an ident server. https://www.postgresql.org/docs/12/auth-ident.html's claim Virtually every Unix-like operating system ships with an ident server that listens on TCP port 113 by default throw me off. Reading that document more closely makes me feel using ident is not the best choice and it is strange that the default config uses it. Now it makes sense that I couldn't find it. The socket is located at /var/run/postgresql. Thanks. Per https://www.postgresql.org/docs/12/auth-pg-hba-conf.html, peer authentication will be used instead of ident for local connections. This appears to require me to either run httpd as postgres or add apache as a postgres user. Agree? Either of these reasonable choices, or maybe give this crusade up and utilize host authentication as Phi11W suggested? Any suggestions how to run a single virtual host as a different user? 2020-03-19 12:05:35.761 UTC [47784] LOG: provided user name (postgres) and authenticated user name (apache) do not match 2020-03-19 12:05:35.761 UTC [47784] FATAL: Peer authentication failed for user "postgres" 2020-03-19 12:05:35.761 UTC [47784] DETAIL: Connection matched pg_hba.conf line 80: "local all all peer"
  2. Thanks Phill, Appreciate your great response. Reading it once, twice, and three times. I think all is good.
  3. I should know this but I don't. How does one find the path to a desired socket file? I too am sure I don't need an authentication system on port 113. But I appear to have one and after spending a fair amount of time trying to figure out what it is, still am not closer. Should it have some service name? If so, please let me know what I might try.
  4. Oh, I thought you were talking about one of the conf files and not the login prompt. I cannot leave the host field blank unless I include a service. Not sure but I think they are referring to a service as some pre-configured host/port/username thing. Did my indent server question make any sense? Evidently, all unix type systems have one running on port 113. I looked at all my services running on the machine and couldn't find one that seemed like this purpose. I couldn't find any options for socket connections described by https://www.pgadmin.org/docs/pgadmin4/development/config_py.html. Have you ever used pgadmin and if so configured to connect via a unix socket and not a host? Thanks
  5. I previously didn't have permissions set up correctly for pgsql's log file so I didn't get the first log. 2020-03-17 20:32:45.678 UTC [2758] LOG: could not connect to Ident server at address "127.0.0.1", port 113: Connection refused 2020-03-17 20:32:45.678 UTC [2758] FATAL: Ident authentication failed for user "postgres" 2020-03-17 20:32:45.678 UTC [2758] DETAIL: Connection matched pg_hba.conf line 83: " host all all 127.0.0.1/32 ident" If connection was refused, I must have an Ident server, but cannot find it. I've looked for ident, identd, authd, xinetd, and others but no luck. I do have "ident - identify RCS keyword strings in files" but I don't think this is applicable. Also checked whether anything is listening to port 113 and can't find anything. Anything else it might be called?
  6. Don't think it is ideal, but am able to connect after changing ident to trust for both local and host in /var/lib/pgsql/12/data/pg_hba.conf.
  7. Thanks again requinix, A little off topic for the php coding help forum but relevant to this specific post. I also installed pgAdmin on the same machine as PostgreSQL, however, cannot connect as shown by /var/lib/pgsql/12/data/log/postgresql-Tue.log 2020-03-17 12:24:49.921 UTC [2272] FATAL: Ident authentication failed for user "michael" 2020-03-17 12:24:49.921 UTC [2272] DETAIL: Connection matched pg_hba.conf line 82: "host all all 127.0.0.1/32 ident" Since I am on the same machine, I used host 127.0.0.1. But then the user running the webserver and thus pgAmin is apache and not michael, true? I considered using PostgreSQL to set up authentication for apache but don't believe it is a good idea. Was thinking of adding my remote client's IP or the server's IP to pg_hba.conf and use some authentication other than ident, however, this too doesn't seem right. Maybe I should be using "service" instead of a username in the pgAdmin prompt but not sure what to include. Any advise would be much appreciated. # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident # Allow replication connections from localhost, by a user with the # replication privilege. local replication all peer host replication all 127.0.0.1/32 ident host replication all ::1/128 ident
  8. Thanks requinix, Your reply was very helpful. I am still a little confused about users and roles, schemas and databases, and clusters. Guess that is why you said "Be careful about ownerships". Are not roles and (postgresql) owners the same thing? Owners are operating system owners that are assigned postgresql roles, true? php-fpm was originally set up as follows but I received an error and discovered that I needed to change user from apache to $pool. Probably same thing for group? listen.owner and listen.group remains as is, right? Rest look okay? /etc/httpd/conf.d/php.conf ... Define PHP7_POOL_TESTING "proxy:unix:/run/php-fpm/testing.sock|fcgi://localhost" ... /etc/php-fpm.d/testing.conf [testing] prefix = /run/php-fpm user = apache ;need to change to $pool group = apache listen.owner = apache listen.group = apache listen.mode = 0660 listen = $pool.sock pm = ondemand pm.max_children = 50 php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/session php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache slowlog = /var/log/php-fpm/testing-slow.log Using superuser user/role postgres, I created role michael and then created a database for that role (all role's must have a database of same name, right?). My desire was for this role to be the primary administrator but not quite have superuser status. I then created role testing which is the same as the php-fpm pool user, and then tried to create the database under role michael but couldn't. Shouldn't I be able to? Ended up doing so using role postgres. [michael@devserver www]$ sudo -u michael psql psql (12.2) Type "help" for help. michael=> \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- michael | michael | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) michael=> \du List of roles Role name | Attributes | Member of ------------+------------------------------------------------------------+----------- testing | | {} michael | Create role, Create DB | {} postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {} michael=> CREATE DATABASE testing OWNER testing; ERROR: must be member of role "testing" michael=> Eventually, was able to access the database via PDO. Why is the Schema shown as "public" [michael@devserver www]$ sudo -u testing psql psql (12.2) Type "help" for help. testing=> \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ------------+------------+----------+-------------+-------------+----------------------- testing | testing | UTF8 | en_US.UTF-8 | en_US.UTF-8 | ... same as above (5 rows) testing=> \d List of relations Schema | Name | Type | Owner --------+-------------------------+----------+------------ public | playground | table | testing public | playground_equip_id_seq | sequence | testing (2 rows) testing=> Thanks again!
  9. Hi, Trying PostgreSQL for the first time but not making much progress. Get peer failure when not including a host and Ident error when including a host. Never heard of Ident authentication until today and don't know for sure if I even have such a server running. Using Centos7, PHP7.4 using remi's repo, and PostgreSQL 12 from their repo. Any thoughts? Thanks try { //use Unix domain sockets $dbh = new PDO("pgsql:dbname=postgres", 'postgres', 'secret'); } catch(Exception $e){ echo($e->getMessage().PHP_EOL); } try { $dbh = new PDO("pgsql:host=localhost;dbname=postgres", 'postgres', 'secret'); } catch(Exception $e){ echo($e->getMessage().PHP_EOL); } try { $dbh = new PDO("pgsql:host=127.0.0.1;dbname=postgres", 'postgres', 'secret'); } catch(Exception $e){ echo($e->getMessage().PHP_EOL); } SQLSTATE[08006] [7] FATAL: Peer authentication failed for user "postgres" SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "postgres" SQLSTATE[08006] [7] FATAL: Ident authentication failed for user "postgres"
  10. Regardless of whether deferrable constraints are used, does anyone have any feedback on using PostgreSQL with PHP and how it compares to MySQL and/or MariaDB?
  11. Thanks kicken, Didn't know about target and super, but good to know the rest is not that foreign.
  12. My "position" column is identical to your DisplayOrder column. Agree it is not mission critical and certainly need not be enforced by the DB and not even the application, and will drop it before stressing over it. I believe that any database which implements the standard for unique constraints which I believe is deferrable constraints will automatically eliminate my issue.
  13. Trying to better understand arrow functions and came up with the following script. Other than being longer and renaming this as _this and arguments as _arguments, is the following identical to an arrow function? Thanks return (function(_this, _arguments) { return function() { /* bla bla bla*/ }; })(this, arguments); https://jsbin.com/fazujup/1/edit?html,js,output <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Closure</title> </head> <body> <script type="text/javascript"> const test = { name: 'test object', createAnonFunction: function() { return function() { console.log('createAnonFunction this.name', this.name); console.log('createAnonFunction arguments', arguments); }; }, createArrowFunction: function() { return () => { console.log('createArrowFunction this.name', this.name); console.log('createArrowFunction arguments', arguments); }; }, createClosureFunction: function() { return (function(_this, _arguments) { return function() { console.log('createClosureFunction this.name', this.name); console.log('createClosureFunction arguments', arguments); console.log('createClosureFunction _this.name', _this.name); console.log('createClosureFunction _arguments', _arguments); }; })(this, arguments); }, createArrowFunctionSingleExp: function(a, b) { // if the function body is a single expression, you can leave off the brackets and put it inline. console.log('createArrowFunctionSingleExp this, a, b', this, a, b); return (a, b) => a + b; }, createArrowFunctionSingleArg: function(array) { //if there is only a single argument, you can even leave off the parenthesis around the argument console.log('createArrowFunctionSingleArg this, array', this, array); return array => array[0]; }, createArrowFunctionSingleExpObj: function(name, description) { //To indicate that instead you want a single expression that happens to be an object, you wrap the object with parentheses // ERROR => return (name, description) => {name: name, description: description}; console.log('createArrowFunctionSingleExpObj this', this); return (name, description) => ({name: name, description: description}); } }; const anon = test.createAnonFunction('hello', 'world'); const arrow = test.createArrowFunction('hello', 'world'); const closure = test.createClosureFunction('hello', 'world'); const arrowSingleExp = test.createArrowFunctionSingleExp('hello', 'world'); const arrowSingleArg = test.createArrowFunctionSingleArg('hello', 'world'); const arrowSingleExpObj = test.createArrowFunctionSingleExpObj('hello', 'world'); anon(); arrow(); closure(); console.log('arrowSingleExp', arrowSingleExp(4,5)); console.log('arrowSingleArg', arrowSingleArg(['zero','one'])); console.log('arrowSingleExpObj', arrowSingleExpObj('theName', 'theDescription')); </script> </body> </html>
  14. I've got the following table and data and wish to swap the position value for two records, delete and reorder the positions, or insert and reorder the positions. Currently, I perform the first task by reserving position zero as a temporary placeholder and perform the other two tasks by executing something like "UPDATE series SET position=position-1 WHERE chart_id=3 AND position > 2". It would be simpler to update the entity values and save them, however, I often encounter an interim unique constraint error. CREATE TABLE IF NOT EXISTS series ( id INT(11) NOT NULL AUTO_INCREMENT, chart_id INT(11) NOT NULL, position INT(11) NOT NULL PRIMARY KEY (id), UNIQUE INDEX unique_position (chart_id ASC, position ASC) VISIBLE, UNIQUE INDEX unique_name (chart_id ASC, name ASC) VISIBLE, INDEX IDX_582B2D4DBEF83E0A (chart_id ASC) VISIBLE, CONSTRAINT FK_582B2D4DBEF83E0A FOREIGN KEY (chart_id) REFERENCES chart (id) ON DELETE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; |----|----------|----------| | id | position | chart_id | |----|----------|----------| | . | . | . | | . | . | . | | 3 | 6 | 2 | | 6 | 1 | 3 | | 1 | 2 | 3 | | 4 | 3 | 3 | | 5 | 4 | 3 | | 2 | 1 | 4 | | . | . | . | | . | . | . | |----|----------|----------|
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.