postgresql-9.1

How to handle special characters in the password of a Postgresql URL connection string?

旧城冷巷雨未停 提交于 2020-07-15 06:33:27
问题 Using a Postgresql URL connection string in the format of: postgresql://user:secret@localhost How do I handle special characters in that string (e.g., $ ) so that it will actually function when I connect to my postgres database? I've tried simply URL encoding it, so for example, "test$" becomes "test%24" ... but that seems to be a problem as I get a "FATAL: password authentication failed " error when attempting to use it. 回答1: See Connection URIs in the doc. There are a few things that don't

How to handle special characters in the password of a Postgresql URL connection string?

风格不统一 提交于 2020-07-15 06:33:10
问题 Using a Postgresql URL connection string in the format of: postgresql://user:secret@localhost How do I handle special characters in that string (e.g., $ ) so that it will actually function when I connect to my postgres database? I've tried simply URL encoding it, so for example, "test$" becomes "test%24" ... but that seems to be a problem as I get a "FATAL: password authentication failed " error when attempting to use it. 回答1: See Connection URIs in the doc. There are a few things that don't

Easy way to view postgresql dump files?

老子叫甜甜 提交于 2020-05-09 18:58:26
问题 I have a ton of postgresql dump files I need to peruse through for data. Do I have to install Postgresql and "recover" each one of them into new databases one by one? Or I'm hoping there's a postgresql client that can simply open them up and I can peek at the data, maybe even run a simple SQL query? The dump files are all from a Postgresql v9.1.9 server. Or maybe there's a tool that can easily make a database "connection" to the dump files? UPDATE : These are not text files . They are binary

Easy way to view postgresql dump files?

守給你的承諾、 提交于 2020-05-09 18:58:09
问题 I have a ton of postgresql dump files I need to peruse through for data. Do I have to install Postgresql and "recover" each one of them into new databases one by one? Or I'm hoping there's a postgresql client that can simply open them up and I can peek at the data, maybe even run a simple SQL query? The dump files are all from a Postgresql v9.1.9 server. Or maybe there's a tool that can easily make a database "connection" to the dump files? UPDATE : These are not text files . They are binary

How to select the reserved word (limit) in postgres

爷,独闯天下 提交于 2020-04-18 12:56:14
问题 I have the field 'limit' in a table in my postgres database. I run psql and I can't select, update, change this field because is a reserved word in postgresql. There is a way to manage this field? serene-retreat::SILVER=> select limit from companies; ERROR: syntax error at or near "limit" LINE 1: select limit from companies; 回答1: In SQL reserved (key)words need to be quoted using double quotes: select "limit" from companies; Note that this also makes column case-sensitive: "LIMIT" is a

COPY FROM CSV to Postgres in Ubuntu

╄→гoц情女王★ 提交于 2020-02-04 20:45:53
问题 My question is similar to this one but in Linux Mint 15 (Ubuntu). I've tried the standard COPY (which I used on Windows all the time): COPY public.bio FROM 'tmp/sisinst_bio.csv' DELIMITERS '|' CSV; I receive this error: ERROR: could not open file "/tmp/sisinst_bio.csv" for reading: Permission denied The owner and user of the database is postgres . Tries (1) Creating a user that is the same as my user account for Ubuntu ( zach ) and changing the owner of the database. (2) Moving the csv to

The difference in ordering of enum type literals between PostgreSQL 9.0 and 9.1

六月ゝ 毕业季﹏ 提交于 2020-01-24 09:29:48
问题 There has been some curious update in the way enum types work between PostgreSQL 9.0 and 9.1. The pg_catalog.pg_enum table has a new column enumsortorder in PostgreSQL 9.1. This order seems to override the previous enum ordering based on OIDs. PostgreSQL 9.0 Documentation The OIDs for a particular enum type are guaranteed to be ordered in the way the type should sort, but there is no guarantee about the ordering of OIDs of unrelated enum types. PostgreSQL 9.1 Documentation The OIDs for pg

The difference in ordering of enum type literals between PostgreSQL 9.0 and 9.1

≡放荡痞女 提交于 2020-01-24 09:29:46
问题 There has been some curious update in the way enum types work between PostgreSQL 9.0 and 9.1. The pg_catalog.pg_enum table has a new column enumsortorder in PostgreSQL 9.1. This order seems to override the previous enum ordering based on OIDs. PostgreSQL 9.0 Documentation The OIDs for a particular enum type are guaranteed to be ordered in the way the type should sort, but there is no guarantee about the ordering of OIDs of unrelated enum types. PostgreSQL 9.1 Documentation The OIDs for pg

Months between two dates function

孤者浪人 提交于 2020-01-21 06:32:06
问题 In oracle i can find out no:of months between using MONTHS_BETWEEN function. In postgres i am using extract function for this. eg.like select extract(year from age(current_date, '2012-12-09')) * 12 + extract(month from age(current_date, '2012-12-09')) Is there any other ways(built in functions) in postgres?? 回答1: This is easy to re-implement in PostgreSQL just using SQL functions to tidy up what you've already got: create function months_of(interval) returns int strict immutable language sql

Constraint defined DEFERRABLE INITIALLY IMMEDIATE is still DEFERRED?

ⅰ亾dé卋堺 提交于 2020-01-18 04:43:50
问题 In connection with this answer I stumbled upon a phenomenon I cannot explain. Version: PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit Consider the following demo. Testbed: CREATE TEMP TABLE t ( id integer ,txt text ,CONSTRAINT t_pkey PRIMARY KEY (id) DEFERRABLE INITIALLY IMMEDIATE ); INSERT INTO t VALUES (1, 'one') ,(2, 'two'); 1) UPDATE statement modifying multiple rows: UPDATE t SET id = t_old.id FROM t t_old WHERE (t.id, t_old.id) IN (