From Klas.Stockhem@benders.se Mon Aug 3 11:16:01 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 0176963272D for ; Mon, 3 Aug 2009 08:16:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 85330-01 for ; Mon, 3 Aug 2009 11:15:43 +0000 (UTC) X-Greylist: delayed 00:15:03.520004 by SQLgrey-1.7.6 Received: from mail.benders.se (mail.benders.se [212.247.52.15]) by mail.postgresql.org (Postfix) with ESMTP id 9083C6332D8 for ; Mon, 3 Aug 2009 08:15:49 -0300 (ADT) Received: from comserver.benders.se (Not Verified[100.100.100.171]) by mail.benders.se with MailMarshal (v6, 1, 8, 2172) id ; Mon, 03 Aug 2009 13:00:54 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CA1429.ABE9747D" X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Problems when copy data from dump file Date: Mon, 3 Aug 2009 13:00:53 +0200 Message-ID: <2A250781A3744D48B1529FCC3C2EB8ABCB465E@comserver.benders.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problems when copy data from dump file thread-index: AcoUKatxQu6GqIChQoWfVO6+4kn2gA== From: "Klas Stockhem" To: X-CT-RefID: str=0001.0A0B0206.4A76C35B.005D,ss=1,fgs=0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.739 tagged_above=-10 required=5 tests=BAYES_20=-0.74, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200908/8 X-Sequence-Number: 32917 This is a multi-part message in MIME format. ------_=_NextPart_001_01CA1429.ABE9747D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I get an error when I'm trying to fill my table with data. I have a postgresql dump file and copy-paste the text from the file into my webbased phppgadmin interface. I have created my tables correctly. Down here I have post the error message I get. I suppose it's something with the tab between "5" and the text? I have tried to make both tab and single space but I get the same error both times. =20 SQL error: ERROR: syntax error at or near "5" LINE 2: 5 Slitasje og vedlikehold PRAKTISKE OPPLYSNINGER\r\n\r\nSn&#... ^ =20 =20 COPY artikkel (id, tittel, tekst) FROM stdin; 5 Slitasje og vedlikehold PRAKTISKE OPPLYSNINGER\r\n\r\nSnø og is.\r\nSnør...and more text... \. =20 =20 Does anyone have some tips to an solution? =20 The postgresql version is 7.4.17. =20 =20 ------_=_NextPart_001_01CA1429.ABE9747D Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I get an error when I’m trying to fill = my table with data. I have a postgresql dump file and copy-paste the text from = the file into my webbased phppgadmin interface. I have created my tables = correctly.

Down here I have post the error message I get. = I suppose it’s something with the tab between = “5” and = the text? I have tried to make both tab and single space but I get the same error = both times.

 

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;

5         = ;           Slitasje = og = vedlikehold          &n= bsp; PRAKTISKE OPPLYSNINGER\r\n\r\nSn&#248; og is.\r\nSn&#248;r...and more = text... \.

 

 

Does anyone have some tips to an = solution?

 

The postgresql version is 7.4.17.

 

 <= /o:p>

------_=_NextPart_001_01CA1429.ABE9747D-- From Klas.Stockhem@benders.se Mon Aug 3 12:15:06 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id ECC67635FE8 for ; Mon, 3 Aug 2009 09:15:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 95454-06-5 for ; Mon, 3 Aug 2009 12:14:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.benders.se (mail.benders.se [212.247.52.15]) by mail.postgresql.org (Postfix) with ESMTP id 266856360C9 for ; Mon, 3 Aug 2009 09:07:57 -0300 (ADT) Received: from comserver.benders.se (Not Verified[100.100.100.171]) by mail.benders.se with MailMarshal (v6, 1, 8, 2172) id ; Mon, 03 Aug 2009 14:08:06 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CA1433.0F43C6C4" X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Problems when copy data from dump file Date: Mon, 3 Aug 2009 14:08:06 +0200 Message-ID: <2A250781A3744D48B1529FCC3C2EB8ABCB4684@comserver.benders.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Problems when copy data from dump file thread-index: AcoUKatxQu6GqIChQoWfVO6+4kn2gAACUM4Q From: "Klas Stockhem" To: X-CT-RefID: str=0001.0A0B020A.4A76D31B.00A0,ss=1,fgs=0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.739 tagged_above=-10 required=5 tests=BAYES_20=-0.74, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200908/7 X-Sequence-Number: 32916 This is a multi-part message in MIME format. ------_=_NextPart_001_01CA1433.0F43C6C4 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =20 I get an error when I'm trying to fill my table with data. I have a postgresql dump file and copy-paste the text from the file into my webbased phppgadmin interface. I have created my tables correctly. Down here I have post the error message I get. I suppose it's something with the tab between "5" and the text? I have tried to make both tab and single space but I get the same error both times. =20 SQL error: ERROR: syntax error at or near "5" LINE 2: 5 Slitasje og vedlikehold PRAKTISKE OPPLYSNINGER\r\n\r\nSn&#... ^ =20 =20 COPY artikkel (id, tittel, tekst) FROM stdin; 5 Slitasje og vedlikehold PRAKTISKE OPPLYSNINGER\r\n\r\nSnø og is.\r\nSnør...and more text... \. =20 =20 Does anyone have some tips to an solution? =20 The postgresql version is 7.4.17. =20 =20 ------_=_NextPart_001_01CA1433.0F43C6C4 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

 

I get an error when I’m trying to fill = my table with data. I have a postgresql dump file and copy-paste the text from = the file into my webbased phppgadmin interface. I have created my tables = correctly.

Down here I have post the error message I get. = I suppose it’s something with the tab between “5” and = the text? I have tried to make both tab and single space but I get the same error = both times.

 

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;

5         = ;           Slitasje og vedlikehold          &n= bsp; PRAKTISKE OPPLYSNINGER\r\n\r\nSn&#248; og is.\r\nSn&#248;r...and = more text... \.

 

 

Does anyone have some tips to an = solution?

 

The postgresql version is 7.4.17.

 

 <= /o:p>

------_=_NextPart_001_01CA1433.0F43C6C4-- From dev@archonet.com Tue Aug 4 08:36:34 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E6D83633AB9 for ; Tue, 4 Aug 2009 05:36:34 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 00745-06 for ; Tue, 4 Aug 2009 08:36:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.pcl-ipout01.plus.net (relay.pcl-ipout01.plus.net [212.159.7.99]) by mail.postgresql.org (Postfix) with ESMTP id 1E762633A42 for ; Tue, 4 Aug 2009 05:36:23 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAM6Pd0rUnw6R/2dsb2JhbADUO4QYBQ Received: from ptb-relay01.plus.net ([212.159.14.145]) by relay.pcl-ipout01.plus.net with ESMTP; 04 Aug 2009 09:36:21 +0100 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by ptb-relay01.plus.net with esmtp (Exim) id 1MYFVN-0002ER-Ck; Tue, 04 Aug 2009 09:36:21 +0100 Received: from dell36.office.archonet.com (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 557BC274075; Tue, 4 Aug 2009 09:09:03 +0100 (BST) Message-ID: <4A77EC9F.1020202@archonet.com> Date: Tue, 04 Aug 2009 09:09:03 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Klas Stockhem CC: pgsql-sql@postgresql.org Subject: Re: Problems when copy data from dump file References: <2A250781A3744D48B1529FCC3C2EB8ABCB465E@comserver.benders.se> In-Reply-To: <2A250781A3744D48B1529FCC3C2EB8ABCB465E@comserver.benders.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: 20ee58e0a11d3be916d54ed96dcb7dbc X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.594 tagged_above=-10 required=5 tests=AWL=1.005, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/11 X-Sequence-Number: 32920 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; > > 5 Slitasje og vedlikehold PRAKTISKE > 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 From dev@archonet.com Tue Aug 4 13:26:55 2009 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E8D0D632B86 for ; Tue, 4 Aug 2009 10:26:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 00405-03 for ; Tue, 4 Aug 2009 13:26:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.ptn-ipout02.plus.net (relay.ptn-ipout02.plus.net [212.159.7.36]) by mail.postgresql.org (Postfix) with ESMTP id 4BA64632B08 for ; Tue, 4 Aug 2009 10:26:45 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAAPUd0rUnw6U/2dsb2JhbADUc4QYBYIy Received: from fhw-relay07.plus.net ([212.159.14.148]) by relay.ptn-ipout02.plus.net with ESMTP; 04 Aug 2009 14:26:41 +0100 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by fhw-relay07.plus.net with esmtp (Exim) id 1MYK2L-0006xN-EH; Tue, 04 Aug 2009 14:26:41 +0100 Received: from dell36.office.archonet.com (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 3B1F327406C; Tue, 4 Aug 2009 14:26:41 +0100 (BST) Message-ID: <4A783710.6080207@archonet.com> Date: Tue, 04 Aug 2009 14:26:40 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Klas Stockhem CC: PostgreSQL Subject: Re: Problems when copy data from dump file References: <2A250781A3744D48B1529FCC3C2EB8ABCB47A1@comserver.benders.se> In-Reply-To: <2A250781A3744D48B1529FCC3C2EB8ABCB47A1@comserver.benders.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: e844840c398c35df53a09817a9c2a965 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/12 X-Sequence-Number: 32921 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 From Klas.Stockhem@benders.se Wed Aug 5 09:57:22 2009 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CFFF1634904 for ; Wed, 5 Aug 2009 06:57:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55828-02-2 for ; Wed, 5 Aug 2009 09:57:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.benders.se (mail.benders.se [212.247.52.15]) by mail.postgresql.org (Postfix) with ESMTP id 858C7635A7C for ; Wed, 5 Aug 2009 06:56:27 -0300 (ADT) Received: from comserver.benders.se (Not Verified[100.100.100.171]) by mail.benders.se with MailMarshal (v6, 1, 8, 2172) id ; Wed, 05 Aug 2009 11:56:36 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Problems when copy data from dump file Date: Wed, 5 Aug 2009 11:56:35 +0200 Message-ID: <2A250781A3744D48B1529FCC3C2EB8ABCB483B@comserver.benders.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: SV: [SQL] Problems when copy data from dump file thread-index: AcoVBz7DH2fUbh+kSTyJiHlzPA/ESAAp0lbA From: "Klas Stockhem" To: "Richard Huxton" Cc: "PostgreSQL" X-CT-RefID: str=0001.0A0B0204.4A795747.029F,ss=1,fgs=0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/17 X-Sequence-Number: 32926 -----Ursprungligt meddelande----- Fr=E5n: Richard Huxton [mailto:dev@archonet.com]=20 Skickat: den 4 augusti 2009 15:27 Till: Klas Stockhem Kopia: PostgreSQL =C4mne: Re: SV: [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=20 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: >=20 >=20 > 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? >=20 > 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=20 work, you must have PHP 4.2 or higher." So - it looks like you should save the COPY script to a text-file and=20 upload it. I don't know how you do that, but it should be in the manual. --=20 Richard Huxton Archonet Ltd > > > ok, I have downloaded and installed EMS SQL query 2007 local on my = computer and it works fine to connect to my database server from this = software. (It did'nt work with the phpPGadmin web interface.) I have also inserted data into my tables ansql query it works fine. I have just one problem left: I must type the schema name and table name = in all sql queries to get some outputs. E.g Schema2.table This makes some problems in my web applications. When I execute my php = files in the web browser the sql server returns "schema "public2" does = not exist". It reads the sql query in my web application like a small p = but I have typed big P in the php file. I can run this in the EMS = software and there it works fine. When I try to just type the table name in sql query like "SELECT * FROM = tablename" I get error "relation "tablename" does not exist". Does the php engine interpret the big P like a small one? Is it recommended to always have small letters in schema names? How do I make so I not must type the schema name in every sql query? The = best would be if I just can type the table name. //Klas From dev@archonet.com Thu Aug 6 07:36:31 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 256B76324CE for ; Thu, 6 Aug 2009 04:36:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 79218-09 for ; Thu, 6 Aug 2009 07:36:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.ptn-ipout01.plus.net (relay.ptn-ipout01.plus.net [212.159.7.35]) by mail.postgresql.org (Postfix) with ESMTP id 4C9056327DA for ; Thu, 6 Aug 2009 04:36:20 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEADclekrUnw4R/2dsb2JhbADVC4QYBYFM Received: from pih-relay04.plus.net ([212.159.14.17]) by relay.ptn-ipout01.plus.net with ESMTP; 06 Aug 2009 08:36:18 +0100 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay04.plus.net with esmtp (Exim) id 1MYxWL-0004B3-V6; Thu, 06 Aug 2009 08:36:18 +0100 Received: from dell36.office.archonet.com (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id A58C9274067; Thu, 6 Aug 2009 08:36:17 +0100 (BST) Message-ID: <4A7A87F1.60904@archonet.com> Date: Thu, 06 Aug 2009 08:36:17 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Klas Stockhem CC: PostgreSQL Subject: Re: Problems when copy data from dump file References: <2A250781A3744D48B1529FCC3C2EB8ABCB483B@comserver.benders.se> In-Reply-To: <2A250781A3744D48B1529FCC3C2EB8ABCB483B@comserver.benders.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: c85cc0889d386a9d99bf17d9a739708b X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.611 tagged_above=-10 required=5 tests=AWL=0.989, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/23 X-Sequence-Number: 32932 Klas Stockhem wrote: > Does the php engine interpret the big P like a small one? It's not PHP, but PostgreSQL itself. All names in PostgreSQL are case insensitive unless you double-quote them. PostgreSQL actually translates everything to lower-case internally. CREATE TABLE1 ...; -- gives "table1" CREATE "TABLE2" ...; -- gives "TABLE2" SELECT * FROM table1 -- works SELECT * FROM TABLE1 -- works SELECT * FROM TaBlE1 -- works SELECT * FROM "table1" -- works SELECT * FROM "TABLE1" -- FAILS, actually "table1" SELECT * FROM table2 -- FAILS, looks for "table2" SELECT * FROM TABLE2 -- FAILS, still looking for "table2" SELECT * FROM "TABLE2" -- works So - if you double-quote a table-name (or function or schema name) when you create it, you should always double-quote it when using it. I'm guessing something added double-quotes for you when you created the schema. > Is it recommended to always have small letters in schema names? Personally, I do. I think it looks neater. > How do I make so I not must type the schema name in every sql query? > The best would be if I just can type the table name. There is a variable called "search_path" which controls what schemas are checked for tables, functions etc. If you have two tables with the same name but different schemas you'll need to use the . format though. SET search_path = public2,public; ALTER USER myuser SET search_path = ... ALTER DATABASE mydb SET search_path = ... -- Richard Huxton Archonet Ltd From Klas.Stockhem@benders.se Thu Aug 6 08:39:49 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7C2AC632337 for ; Thu, 6 Aug 2009 05:39:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 89810-08 for ; Thu, 6 Aug 2009 08:39:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.benders.se (mail.benders.se [212.247.52.15]) by mail.postgresql.org (Postfix) with ESMTP id 68336632B7F for ; Thu, 6 Aug 2009 05:39:38 -0300 (ADT) Received: from comserver.benders.se (Not Verified[100.100.100.171]) by mail.benders.se with MailMarshal (v6, 1, 8, 2172) id ; Thu, 06 Aug 2009 10:39:46 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Re: Problems when copy data from dump file Date: Thu, 6 Aug 2009 10:39:46 +0200 Message-ID: <2A250781A3744D48B1529FCC3C2EB8ABCB48FF@comserver.benders.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: SV: SV: [SQL] Problems when copy data from dump file thread-index: AcoWaKAW97h1Ak94Q8SmydLeqJr/3gABXJog From: "Klas Stockhem" To: "Richard Huxton" Cc: "PostgreSQL" X-CT-RefID: str=0001.0A0B0208.4A7A96C6.0133,ss=1,fgs=0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.669 tagged_above=-10 required=5 tests=AWL=0.930, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/29 X-Sequence-Number: 32938 =09 Klas Stockhem wrote: > Does the php engine interpret the big P like a small one? It's not PHP, but PostgreSQL itself. All names in PostgreSQL are case=20 insensitive unless you double-quote them. PostgreSQL actually translates everything to lower-case internally. CREATE TABLE1 ...; -- gives "table1" CREATE "TABLE2" ...; -- gives "TABLE2" SELECT * FROM table1 -- works SELECT * FROM TABLE1 -- works SELECT * FROM TaBlE1 -- works SELECT * FROM "table1" -- works SELECT * FROM "TABLE1" -- FAILS, actually "table1" SELECT * FROM table2 -- FAILS, looks for "table2" SELECT * FROM TABLE2 -- FAILS, still looking for "table2" SELECT * FROM "TABLE2" -- works So - if you double-quote a table-name (or function or schema name) when=20 you create it, you should always double-quote it when using it. I'm=20 guessing something added double-quotes for you when you created the schema. > Is it recommended to always have small letters in schema names? Personally, I do. I think it looks neater. > How do I make so I not must type the schema name in every sql query? > The best would be if I just can type the table name. There is a variable called "search_path" which controls what schemas are checked for tables, functions etc. If you have two tables with the same=20 name but different schemas you'll need to use the .
=20 format though. SET search_path =3D public2,public; ALTER USER myuser SET search_path =3D ... ALTER DATABASE mydb SET search_path =3D ... --=20 Richard Huxton Archonet Ltd > > > Yes It works fine when I execute the SET command and the ALTER USER command in the EMS software! Now my web application return data from the database tables that contains some data. (I have manually put data in some tables from the EMS software). I have "a lot of" data still left in the dump file to put in the database. I can manually put the data in the tables but this will take some times.=20 The data in the dump file are structured and I want to execute this automatically (copy+paste it) in the EMS software. I still get the syntax error even if I use the command you send me: COPY artikkel (id, tittel, tekst) FROM stdin; 1Title oneSome text \. This is the error I get : "ERROR: syntax error at or near "1" at character 47". It feels like it is some simple error but I can't find it out. I would help me a lot if I get a solution. //Klas From dev@archonet.com Thu Aug 6 08:42:20 2009 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 68CB06327DA for ; Thu, 6 Aug 2009 05:42:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 26844-01 for ; Thu, 6 Aug 2009 08:42:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.pcl-ipout02.plus.net (relay.pcl-ipout02.plus.net [212.159.7.100]) by mail.postgresql.org (Postfix) with ESMTP id C1EEB634625 for ; Thu, 6 Aug 2009 05:42:09 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEALQ0ekrUnw6T/2dsb2JhbADUcIQYBQ Received: from ptb-relay03.plus.net ([212.159.14.147]) by relay.pcl-ipout02.plus.net with ESMTP; 06 Aug 2009 09:42:07 +0100 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by ptb-relay03.plus.net with esmtp (Exim) id 1MYyY3-0000IS-Du; Thu, 06 Aug 2009 09:42:07 +0100 Received: from dell36.office.archonet.com (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 26D89274067; Thu, 6 Aug 2009 09:42:07 +0100 (BST) Message-ID: <4A7A975E.8050403@archonet.com> Date: Thu, 06 Aug 2009 09:42:06 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Klas Stockhem CC: PostgreSQL Subject: Re: Problems when copy data from dump file References: <2A250781A3744D48B1529FCC3C2EB8ABCB48FF@comserver.benders.se> In-Reply-To: <2A250781A3744D48B1529FCC3C2EB8ABCB48FF@comserver.benders.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: f10767fbfbb093df40741a94e0f8db5b X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.185 tagged_above=-10 required=5 tests=BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 200908/24 X-Sequence-Number: 32933 Klas Stockhem wrote: > The data in the dump file are structured and I want to execute this > automatically (copy+paste it) in the EMS software. > I still get the syntax error even if I use the command you send me: > COPY artikkel (id, tittel, tekst) FROM stdin; 1Title oneSome > text \. Why not just load the dump file into PostgreSQL? Why are you trying to copy+paste if you want the entire dump? -- Richard Huxton Archonet Ltd From Klas.Stockhem@benders.se Thu Aug 6 10:01:01 2009 Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E572C6324FB for ; Thu, 6 Aug 2009 07:01:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 04402-02 for ; Thu, 6 Aug 2009 10:00:45 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.benders.se (mail.benders.se [212.247.52.15]) by mail.postgresql.org (Postfix) with ESMTP id C725763271F for ; Thu, 6 Aug 2009 07:00:50 -0300 (ADT) Received: from comserver.benders.se (Not Verified[100.100.100.171]) by mail.benders.se with MailMarshal (v6, 1, 8, 2172) id ; Thu, 06 Aug 2009 12:00:46 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Problems when copy data from dump file Date: Thu, 6 Aug 2009 12:00:46 +0200 Message-ID: <2A250781A3744D48B1529FCC3C2EB8ABCB4934@comserver.benders.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Problems when copy data from dump file thread-index: AcoWcdGpPsvRAiguRVK5D1o/pENLbQAB6pvQ From: "Klas Stockhem" To: "Richard Huxton" Cc: "PostgreSQL" X-CT-RefID: str=0001.0A0B0206.4A7AA9C2.00B1,ss=1,fgs=0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.05 tagged_above=-10 required=5 tests=AWL=-0.309, BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 200908/31 X-Sequence-Number: 32940 > The data in the dump file are structured and I want to execute this > automatically (copy+paste it) in the EMS software. > I still get the syntax error even if I use the command you send me: > COPY artikkel (id, tittel, tekst) FROM stdin; 1Title oneSome > text \. Why not just load the dump file into PostgreSQL? Why are you trying to=20 copy+paste if you want the entire dump? --=20 Richard Huxton Archonet Ltd > > > I have tried to load the dump file also but get same error. I have check the sql dump file in Ultra editor 32 where you can see the hex value of each character in the file I see the both the original dump file and my copy+paste text contain a tab (hex value 09). Note that I have "CREATE TABLE" script in the dump file and this was executed good in the server. This was copy+pasted also. Maybe you can send me an create table script and one row of a copy command and I can execute this and see if it works? //Klas =20