Re: [SQL] Problems when copy data from dump file
Klas Stockhem wrote: SQL error: ERROR: syntax error at or near "5" LINE 2: 5 Slitasje og vedlikehold PRAKTISKE OPPLYSNINGER\r\n\r\nSn... ^ COPY artikkel (id, tittel, tekst) FROM stdin; 5Slitasje og vedlikeholdPRAKTISKE OPPLYSNINGER\r\n\r\nSnø og is.\r\nSnør...and more text... \. 1. Do you really have a blank line between "COPY" and "5"? If so, that's your problem. 2. Are you perhaps copying+pasting from a Windows machine to a Linux one or similar? You might be getting "\r\n" at the end of lines when it's expecting "\n". The postgresql version is 7.4.17. Might want to set aside some time to upgrade in the near future - you're missing four full versions since 2003. At the very least, upgrade to 7.4.25 at your earliest convenience. -- Richard Huxton Archonet Ltd -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Problems when copy data from dump file
Klas Stockhem wrote: Thanks for your mail! Remember to cc: the mailing list too. Just hit "reply to all". Oh, and perhaps don't top-quote. It makes it difficult for others to follow the message. 1. Yes, the 5 and other text are at line 2 (a new line). I tried to put the whole command on the first line and execute it but I get same error: ERROR: syntax error at or near "1" LINE 1: COPY artikkel (id, tittel, tekst) FROM stdin 1 test test; No, the data needs to start on the line below COPY, but your first email had a blank line there. Your message had: Line 1: COPY artikkel (id, tittel, tekst) FROM stdin; Line 2: (blank) Line 3: 5 Slitasje og vedlikehold PRAKTISKE OPPLYSNINGER What you want is something like: COPY artikkel (id, tittel, tekst) FROM stdin; 1Title oneSome text 2Title twoSome text \. Where the marks are real tabs. I have also separated the 1 and the "test-text" with tab. Is the syntax for the line 1 correct? I have read some about using DELIMITER. Do you have a suggestion how a can use this in the command? 2. Yes I have opened the dump file on in a windows system and copy+paste it into the phppgadmin web interface. Hmm - reading the phppgadmin documentation, the FAQ says the following: "Only uploaded SQL scripts can contain COPY commands and for this to work, you must have PHP 4.2 or higher." So - it looks like you should save the COPY script to a text-file and upload it. I don't know how you do that, but it should be in the manual. -- Richard Huxton Archonet Ltd -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Create table command fails with permission denied
Moderately curious. I wonder if 'cms' is on a different tablespace? Are there tables in that db? Btw, I don't have 7.4 so I'm only guessing based on 8.3 rjs Venkateswara Rao Bondada wrote: Hi Rob, I'm using postgres account (which is a superuser in the database) to create table. Table creation is working fine in other databases except in this. As postgres user, I granted CREATE, USAGE & ALL privileges to postgres account, still it didn't work. Please find the snapshots below where it works fine and also where it doesn't work fine. And let me know what rights postgres account is missing to create tables in "cms" database. == camd=# \c camd postgres You are now connected to database "camd" as user "postgres". camd=# create table test(id character varying(80)); CREATE TABLE camd=# \c cms postgres You are now connected to database "cms" as user "postgres". cms=# create table test(id character varying(80)); ERROR: could not create relation "test": Permission denied cms=# == Thanks, Venkat -Original Message- From: Rob Sargent [mailto:[email protected]] Sent: Tuesday, August 04, 2009 3:33 AM To: Venkateswara Rao Bondada Cc: [email protected] Subject: Re: [SQL] Create table command fails with permission denied Looks to me as though you are not the owner of the schema nor superuser nor in a role with permission to create tables in said schema. See the DBA if it's not you. If it is sign on as postgres (superuser) and grant yourself some access rights. Venkateswara Rao Bondada wrote: Hi, I'm new to PostgreSQL, and currently facing an issue with PostgreSQL 7.4 database. I'm getting the following error when tried to create a table. Please let me know the steps (with queries) that I should take care to resolve this issue. cms=# create table test(id character varying(80)); ERROR: could not create relation "test": Permission denied Thanks in advance, Venkat CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS*** -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Create table command fails with permission denied
Hi Rob, I'm using postgres account (which is a superuser in the database) to create table. Table creation is working fine in other databases except in this. As postgres user, I granted CREATE, USAGE & ALL privileges to postgres account, still it didn't work. Please find the snapshots below where it works fine and also where it doesn't work fine. And let me know what rights postgres account is missing to create tables in "cms" database. == camd=# \c camd postgres You are now connected to database "camd" as user "postgres". camd=# create table test(id character varying(80)); CREATE TABLE camd=# \c cms postgres You are now connected to database "cms" as user "postgres". cms=# create table test(id character varying(80)); ERROR: could not create relation "test": Permission denied cms=# == Thanks, Venkat -Original Message- From: Rob Sargent [mailto:[email protected]] Sent: Tuesday, August 04, 2009 3:33 AM To: Venkateswara Rao Bondada Cc: [email protected] Subject: Re: [SQL] Create table command fails with permission denied Looks to me as though you are not the owner of the schema nor superuser nor in a role with permission to create tables in said schema. See the DBA if it's not you. If it is sign on as postgres (superuser) and grant yourself some access rights. Venkateswara Rao Bondada wrote: > > Hi, > > I'm new to PostgreSQL, and currently facing an issue with PostgreSQL > 7.4 database. I'm getting the following error when tried to create a > table. Please let me know the steps (with queries) that I should take > care to resolve this issue. > > cms=# create table test(id character varying(80)); > > ERROR: could not create relation "test": Permission denied > > Thanks in advance, > > Venkat > -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] Create table command fails with permission denied
Venkateswara Rao Bondada writes: > camd=# \c cms postgres > You are now connected to database "cms" as user "postgres". > cms=# create table test(id character varying(80)); > ERROR: could not create relation "test": Permission denied Actually, what that is complaining about is that the operating system refused its attempt to create a filesystem file to hold the table. It's got nothing to do with permissions inside the database --- there is something wrong with the filesystem permissions of the data directory. Or maybe you started the postmaster as the wrong user (not the one that owns the data directory). regards, tom lane -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
