Why must I create a new user when beginning to use PostgreSQL? - postgresql

After reading some tutorials on installing PostgreSQL, I know that I must create a new OS user such as 'PostgreSQL' in the process of installing. However, I don't know the reason and what would happen if I just use my current user account?
The same question on Odoo.
My Account Setting

you have to define a "database owner". Normaly you use SQL on a Server with multible access accounts.
Nothing would happen if you use your own account to install it or define it as DB owned.
You should just recognize some PostgresSQL services running with you local account under der "services" section....

Related

PostgreSQL get windows user during insert

I have windows based application that communicates with PostgreSQL (installed on another Windows Server). Currently I use connection string with username and password (user is configured on PostgreSQL DB). Is it possible to somehow change it so that in connection automatically logged to windows User is passed and somehow configured on Postgres so that he can have access to db?
I need to do it in order to add some audit: when record is added to table I would like to add information in separate column about which user inserted it (it would be great to do it on :) thanks!
Answer depends on environment. If you work in domain and all your user do (careful on permissions), then it is possible on server side (see https://www.postgresql.org/docs/12/auth-methods.html)
But if not, then the easiest approach is to include information in insert call, or call function which performs insert, but takes user info as an argument.
If your server is on Windows too, the natural thing to do would be to use SSPI (Windows single-sign-on) authentication. For that, use sspi authentication in pg_hba.conf and add SSPI configuration parameters after that.

Security processing failed with reason "19" ("USERID DISABLED or RESTRICTED"). SQLSTATE=08001

I am running into this error when trying to access db2 through my code, as well as the cloud console. I am using db2 hosted on ibm cloud.
Security processing failed with reason "19" ("USERID DISABLED or RESTRICTED"). SQLSTATE=08001
I am unable to perform sql queries, or access any of my table data through the console, or perform any admin access. I cannot figure out what the issue is let alone how to solve it. What could be my issue?
While I agree with #mao, here is my finding (worked for me with a free account) for anyone who ends up here for the same problem. As suggested in discussion forums at IBM course, Applied-data-science-capstone, you need to create new service credentials for your Db2 database. If you do not have any important table in your current database, it is even safer to delete it and recreate a new Db2 either in London or Dallas region followed by new service credentials. As of today, if you use sqlalchemy package in Python, versions higher than 1.4 are incompadible so:
!pip uninstall sqlalchemy==1.4 -y && pip install sqlalchemy==1.3.24
To find the location of your credentials on IBM cloud check: Connection credentials or this picture.
This is not a question for stackoverflow because it is not about programming Db2. It is an operational matter for IBM.
Some people reported this symptom with accounts that were created long ago, or which failed to migrate to new versions of Db2-on-cloud , or which became expired before migrations through lack of use or lack of renewals.
If you pay for an IBM managed service, then contact IBM cloud support to resolve such problems.
If you have a free (lite) account, currently you get no formal support. You can drop the service, and create a new service , possibly at a different data centre, using a different email address if necessary.

How to take backup of Tableau Server Repository(PostgreSQL)

we are using 2018.3 version of Tableau Server. The server stats like user login, and other stats are getting logged into PostgreSQL DB. and the same being cleared regularly after 1 week.
Is there any API available in Tableau to connect the DB and take backup of data somewhere like HDFS or any place in Linux server.
Kindly let me know if there are any other way other than API as well.
Thanks.
You can enable access to the underlying PostgreSQL repository database with the tsm command. Here is a link to the documentation for your (older) version of Tableau
https://help.tableau.com/v2018.3/server/en-us/cli_data-access.htm#repository-access-enable
It would be good security practice to limit access to only the machines (whitelisted) that need it, create or use an existing read-only account to access the repository, and ideally to disable access when your admin programs are complete (i.e.. enable access, do your query, disable access)
This way you can have any SQL client code you wish query the repository, create a mirror, create reports, run auditing procedures - whatever you like.
Personally, before writing significant custom code, I’d first see if the info you want is already available another way, in one of the built in admin views, via the REST API, or using the public domain LogShark or TabMon systems or with the Addon (for more recent versions of Tableau) the Server Management Add-on, or possibly the new Data Catalog.
I know at least one server admin who somehow clones the whole Postgres repository database periodically so he can analyze stats offline. Not sure what approach he uses to clone. So you have several options.

How to use a different user (other than postgres) for managing PostgreSQL

I will need to get PostgreSQL installed on some development/production machines in my company.
However, there are many restrictions:
First, I am not allowed to install it myself because I don't have root access and I am also not allowed to compile it from source. I will need to ask another team to install it from rpm.
Second, PostgreSQL will create/use the account "postgres" to start/stop/control it by default - but we want to use an existing account (e.g. "itdept") to manage (i.e. start/stop/etc.) it.
I would greatly appreciate it if anyone has any suggestions/ideas. Thanks very much!

How to show filter databases in management studio object explorer

My database is hosted in a shared hosting. I connect my database remotely in Management Studio Express. Whenever i try to connect to sqlserver instance it shows all the databases that are hosted in that server instance. This annoying to find out your database out of 400 database of the other users all the time.
Is there a any way to filter down the list of databases to those i won or have permission ? i don't want to see databases that i don't have permission or i don't own.
Remember my database is hosted in a shared hosting and as a user i have limited privilege.
I've researched a similar issue and the only method I've found that works for this is a little hackish, however it may work for you in this case. If you (or the administrator of your shared host) is able to make your login the DBO of your database, and then also DENY VIEW to all databases for your login, you should only see the database that your login owns when you connect. So the t-sql would be:
`USE AdventureWorks2008R2
ALTER AUTHORIZATION ON DATABASE::AdventureWorks2008R2 to TestLogin
USE MASTER
DENY VIEW ANY DATABASE TO TestLogin`
Not sure if this is a fit for your scenario, and definitely not saying it is a best practice, but maybe it helps!
I have created the solutio for this problem in SSMSBoost add-in for SSMS (I am the developer of this add-in).
There is a special "Smart connection switch" combobox on the toolbar, that you can configure to show your favorite connections (Preferred connections), also you can display all local databases, BUT only those, that you can access.