{"action":"created","issue":{"url":"https://api.github.com/repos/dbcli/pgcli/issues/705","repository_url":"https://api.github.com/repos/dbcli/pgcli","labels_url":"https://api.github.com/repos/dbcli/pgcli/issues/705/labels{/name}","comments_url":"https://api.github.com/repos/dbcli/pgcli/issues/705/comments","events_url":"https://api.github.com/repos/dbcli/pgcli/issues/705/events","html_url":"https://github.com/dbcli/pgcli/issues/705","id":225269257,"number":705,"title":"unexpected /copy syntax error","user":{"login":"bobcolner","id":959946,"avatar_url":"https://avatars3.githubusercontent.com/u/959946?v=3","gravatar_id":"","url":"https://api.github.com/users/bobcolner","html_url":"https://github.com/bobcolner","followers_url":"https://api.github.com/users/bobcolner/followers","following_url":"https://api.github.com/users/bobcolner/following{/other_user}","gists_url":"https://api.github.com/users/bobcolner/gists{/gist_id}","starred_url":"https://api.github.com/users/bobcolner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobcolner/subscriptions","organizations_url":"https://api.github.com/users/bobcolner/orgs","repos_url":"https://api.github.com/users/bobcolner/repos","events_url":"https://api.github.com/users/bobcolner/events{/privacy}","received_events_url":"https://api.github.com/users/bobcolner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-04-29T16:42:39Z","updated_at":"2017-04-30T00:23:28Z","closed_at":null,"body":"## Description\r\nWhen using the `/copy` command as documented I get a syntax error.\r\n\r\n```\r\n> \\copy myschema.mytable to './out.csv'\r\nsyntax error at or near \"STDOUT\"\r\nLINE 1: copy myschema.mytable to  STDOUT\r\n                                 ^\r\nTime: 0.097s\r\n```\r\n\r\n```\r\n> \\copy (select 1) to stdout\r\nsyntax error at or near \"(\"\r\nLINE 1: copy (select 1) to  STDOUT\r\n             ^\r\n\r\nTime: 0.096s\r\n\r\n```\r\n\r\n## Your environment\r\nmacOS, python3.6, redshift pgcli Version: 1.5.1\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dbcli/pgcli/issues/comments/298202850","html_url":"https://github.com/dbcli/pgcli/issues/705#issuecomment-298202850","issue_url":"https://api.github.com/repos/dbcli/pgcli/issues/705","id":298202850,"user":{"login":"j-bennet","id":637013,"avatar_url":"https://avatars2.githubusercontent.com/u/637013?v=3","gravatar_id":"","url":"https://api.github.com/users/j-bennet","html_url":"https://github.com/j-bennet","followers_url":"https://api.github.com/users/j-bennet/followers","following_url":"https://api.github.com/users/j-bennet/following{/other_user}","gists_url":"https://api.github.com/users/j-bennet/gists{/gist_id}","starred_url":"https://api.github.com/users/j-bennet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-bennet/subscriptions","organizations_url":"https://api.github.com/users/j-bennet/orgs","repos_url":"https://api.github.com/users/j-bennet/repos","events_url":"https://api.github.com/users/j-bennet/events{/privacy}","received_events_url":"https://api.github.com/users/j-bennet/received_events","type":"User","site_admin":false},"created_at":"2017-04-30T00:23:28Z","updated_at":"2017-04-30T00:23:28Z","body":"I never used redshift before, but from what I see, it is based on postgresql 8.0.2. That version of postgresql allows copying table -> file (or table -> stdout), but not query -> file (or query -> stdout). Documentation for 8.0:\r\n\r\nhttps://www.postgresql.org/docs/8.0/static/sql-copy.html\r\n\r\nVs current:\r\n\r\nhttps://www.postgresql.org/docs/current/static/sql-copy.html\r\n\r\nI tried connecting to an 8.0.2 database (in docker) using `psql`. Here is what I get:\r\n\r\n```\r\ndocker=> \\copy abc to stdout;\r\n1\ta\r\n2\tb\r\n3\tc\r\ndocker=> \\copy abc to 'aaa.txt';\r\nCOPY\r\ndocker=> copy (select 1) to stdout;\r\nERROR:  syntax error at or near \"(\"\r\nLINE 1: copy (select 1) to stdout;\r\n             ^\r\ndocker=>\r\n```\r\n\r\nIf I use `pgcli`, I get exactly the same result:\r\n\r\n```\r\ndocker@127.0.0.1:docker> \\copy abc to 'aaa.txt'\r\n\r\nTime: 0.002s\r\ndocker@127.0.0.1:docker> \\copy abc to stdout\r\n1\ta\r\n2\tb\r\n3\tc\r\n\r\nTime: 0.001s\r\ndocker@127.0.0.1:docker> \\copy (select 1) to stdout\r\nsyntax error at or near \"(\"\r\nLINE 1: copy (select 1) to  STDOUT\r\n             ^\r\n\r\nTime: 0.003s\r\ndocker@127.0.0.1:docker>\r\n```\r\n\r\n`abc` is the name of my test table."}}
{"actor":{"display_login":"j-bennet"}}