pgAdmin

Heroku pg:pull is giving sh: createdb: command not found

时光毁灭记忆、已成空白 提交于 2019-12-04 10:37:25
When I try to do heroku pg:pull DATABASE_URL myappspassword , I get this error: my-computer:a-folder (master*) · heroku pg:pull DATABASE_URL myappspassword ! sh: createdb: command not found ! ! Unable to create new local database. Ensure your local Postgres is working and try again. For once Googling doesn't return a result. I'm wondering if it's related to the fact that when I do which psql , there is no result. Maybe I need to do something special with pgAdmin to get this working (e.g. export command line tools)? Are you on a Mac, by chance, and using Postgres App ? If so, the problem might

Debug SQL in pgAdmin when SQL contains variables

落花浮王杯 提交于 2019-12-04 09:38:56
问题 In SQL Server I could copy sql code out of an application and paste it into SSMS, declare & assign vars that exist in the sql and run. yay great debugging scenario. E.g. (please note I am rusty and syntax may be incorrect): declare @x as varchar(10) set @x = 'abc' select * from sometable where somefield = @x I want to do something similar with Postgres in pgAdmin (or another postgres tool, any recommendations?) where I can just drop my SQL (params & all) into something that will run against

Nested Case statement type error (postgres)

孤街醉人 提交于 2019-12-04 06:54:33
问题 I have some postgres code I have created that is giving me an error: ERROR: CASE types character varying and numeric cannot be matched CODE: CREATE TABLE current_condition_joined AS SELECT a.id, a.geom, a.condition_join_1, a.condition_join_2, a.condition_join_3, (CASE WHEN b.condition = 'ERROR' THEN (CASE WHEN c.condition2 = 'ERROR' THEN d.condition3 ELSE c.condition2 END) ELSE b.condition END) current_condition, (CASE WHEN b.condition= 'ERROR' THEN (CASE WHEN c.condition2 = 'ERROR' THEN d

Why postgres show two different format for same interval value?

烈酒焚心 提交于 2019-12-04 03:29:56
问题 I was helping with this question trying to change the format for the interval. from '01 day 22:10:37' to '46:10:37' I give a solution with string manipulation. But then I found postgres can show the same interval on two different format. SELECT '2016-01-27 08:51:02'::timestamp - '2016-01-25 10:40:25'::timestamp end_date, '46:10:37'::interval interval_date; Funny thing. There is a function doing the inverse process justify_hours('46:10:37'::interval) --> '1 day 22:10:37' So I wondering if

postgresql数据库备份还原

北慕城南 提交于 2019-12-04 02:23:09
一、备份 1.命令行下备份为纯文本格式 切换为postgres用户(linux 命令) su - postgres 备份到backupfile.bak pg_dump dbname > backupfile.bak windows下使用-U参数切换用户 pg_dump -h localhost -U postgres -p 5555 dbname > backupfile.bak 2.pgAdmin 4客户端备份为 归档文件格式 二、还原 纯文本格式的脚本 使用psql 1.cd到postgresql安装目录,如:d:\program files\postgresql\10\bin> 2.执行 psql -U postgres -d dbname -p 5555 < backupfile.bak 另:使用CMD,不要使用powershell 不加-U(大写),windows下默认是administrator用户,-p是端口 归档文件格式(.sql文件,.backup文件) 使用pg_restore 参数:-d 数据库 -j 线程数(可以多线程提高速度) -v 详细模式(显示还原过程)-U(用户名,windows下需要加这项) pg_restore --dbname=mydb --jobs=4 --verbose mydb.backup 简写:pg_restore -d mydb

How to backup & Restore PostgreSQL database in Windows7?

只谈情不闲聊 提交于 2019-12-03 16:56:34
I am new to Postgres database. I have to get the backup from Production Server (pgAdmin Version is 9.2.4) & restore it on my local machine (I have pgAdmin Version 9.4). I tried to get backup by right clicking on database -> Backup to get the .backup file. Like shown in below image: But when I try to restore the backup file, I get many errors. I also want to know whether having different ports at both system can also create issues while restoring backups. As When I tried to restore backup of same system had no problems. To backup a database you can use pg_dump.exe : Open command line window Go

pgAdmin III : No servers showing up

梦想的初衷 提交于 2019-12-03 16:48:30
I've followed many online tutorials on how to install pgAdmin correctly, I've installed and uninstalled it multiple times but whenever install it. It shows Server Groups without any servers in it. Then when I try and register a new server using localhost for both name and host I get this error: server doesn't listen Searched for days trying to find a solution for this, any ideas? happened with me as well, when I started pgadmin3 for the first time, i was expecting it to ask for the password which I provided during but it didnt ask and then didnt display any servers. anyways, you can create a

Equivalent of “describe table” in PgAdmin3

↘锁芯ラ 提交于 2019-12-03 15:28:02
问题 Question asked and answered: As many of us know, PostgreSQL does not support describe table or describe view . As one might find from google, PostgreSQL uses \d+ instead. However, if one accesses PostgreSQL using PgAdmin (I am actually using PgAdmin3) then \d+ does not work. What does one do instead? I thought about this question when playing with the query tool in PgAdmin3. I had a "well, duh!" moment when I thought to look at the home window of PgAdmin3, and at the tree on the left side of

PostgreSQL - create a new DB through pgAdmin UI

こ雲淡風輕ζ 提交于 2019-12-03 14:38:13
问题 I have installed PostgreSQL DB server on my Ubuntu machine. Now I want to create a new Database through some GUI application. I tried pgAdmin but didn't find any option to create a new DB. But I could add existing db servers. Is there any way to create a DB and then tables through pgAdmin or some other app. Basically I am looking for an application for PostgreSQL like SQLYog for MySQL. 回答1: Open pgAdmin Connect to database server Edit => New Object => New database done Or use plain SQL when

how to execute pgsql script in pgAdmin?

删除回忆录丶 提交于 2019-12-03 10:43:46
I want to execute some pgScript directly from the pgAdmin editor UI. FOR i IN 1..10 LOOP PRINT i; -- i will take on the values 1,2,3,4,5,6,7,8,9,10 within the loop END LOOP; But I always got [ERROR ] 1.0: syntax error, unexpected character I also tried to wrap the code with do$$...$$ , but does not solve the problem. Vivek S. apart from Clodoaldo Neto's Answer .You can try this also DO $$ BEGIN FOR i IN 1..10 LOOP RAISE NOTICE '%', i; -- i will take on the values 1,2,3,4,5,6,7,8,9,10 within the loop END LOOP; END $$ There is no PRINT command. Use raise notice instead. create function f()