[SQL] Syntax Error in COPY when “create function”

2007-02-26 Thread hongliu zou
Am I forgetting some limitation? I get " ERROR: syntax error at or near "$1" SQL state: 42601 "with this CREATE FUNCTION Import1() RETURNS text AS $$ DECLARE path Char(100); BEGIN path = 'C:/zhl/hjs/anc_area.att'; COPY anc_areaAtt FROM path CVS;

Re: [SQL] Change Default Database

2007-02-26 Thread Rommel the iCeMAn
B!!!, I was there late last November, it must be far worse now! I'll be sticking close to the forums from now on :-) ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgres

Re: [SQL] Change Default Database

2007-02-26 Thread Scott Marlowe
On Mon, 2007-02-26 at 16:02, Rommel the iCeMAn wrote: > I seem to be blundering a lot today! I thought I was replying to the entire > list, didn't realize I replied to one person :-) > > Nothing was wrong with my script, I assumed that since it was generated by > pgAdmin that I could run it inside

Re: [SQL] Change Default Database

2007-02-26 Thread Rommel the iCeMAn
I seem to be blundering a lot today! I thought I was replying to the entire list, didn't realize I replied to one person :-) Nothing was wrong with my script, I assumed that since it was generated by pgAdmin that I could run it inside pgAdmin. It works perfectly when I run it using psql. It is ver

Re: [SQL] Change Default Database

2007-02-26 Thread Scott Marlowe
On Mon, 2007-02-26 at 14:52, Rommel the iCeMAn wrote: > Hi again, > > Apologies for the HTML. > > This is an SQL script, it was generated by doing a schema-only database dump > using pgAdminIII (which in turn uses pgdump I believe). I've attached the > entire script. I was attempting to run this

Re: [SQL] Change Default Database

2007-02-26 Thread Scott Marlowe
On Mon, 2007-02-26 at 10:52, Rommel the iCeMAn wrote: > Hi list, > > I wrote a database creation script that begins with commands to drop > the existing database (if it exists) and create it from scratch. These > commands execute fine, the problem is that all subsequent commands are > executed on

Re: [SQL] Change Default Database

2007-02-26 Thread Rodrigo De León
On 2/26/07, Rommel the iCeMAn <[EMAIL PROTECTED]> wrote: Thanks for the swift responses, I tried the \c command but I got the following error: ERROR: syntax error at or near "\" SQL state: 42601 Character: 520 Here's a code snippet ... -- -- TOC entry 1685 (class 1262 OID 16453) -- Name: tes

[SQL] getting at sequence previous/next values

2007-02-26 Thread Louis-David Mitterrand
Hello, I've got a table that looks basically like: id_show | serial show_name | text show_type | text created_on | timestamp without time zone When looking at a row with an id_show of value n, I'd like to have an

Re: [SQL] Change Default Database

2007-02-26 Thread Rommel the iCeMAn
Thanks for the swift responses, I tried the \c command but I got the following error: ERROR: syntax error at or near "\" SQL state: 42601 Character: 520 Here's a code snippet ... -- -- TOC entry 1685 (class 1262 OID 16453) -- Name: test_db; Type: DATABASE; Schema: -; Owner: postgres -- DROP D

Re: [SQL] Change Default Database

2007-02-26 Thread Rodrigo De León
On 2/26/07, Rommel the iCeMAn <[EMAIL PROTECTED]> wrote: Hi list, I wrote a database creation script that begins with commands to drop the existing database (if it exists) and create it from scratch. These commands execute fine, the problem is that all subsequent commands are executed on the def

Re: [SQL] Change Default Database

2007-02-26 Thread Richard Huxton
Rommel the iCeMAn wrote: Hi list, I wrote a database creation script that begins with commands to drop the existing database (if it exists) and create it from scratch. These commands execute fine, the problem is that all subsequent commands are executed on the default database 'postgres'. What

[SQL] Change Default Database

2007-02-26 Thread Rommel the iCeMAn
Hi list, I wrote a database creation script that begins with commands to drop the existing database (if it exists) and create it from scratch. These commands execute fine, the problem is that all subsequent commands are executed on the default database 'postgres'. What command can I use to set th

Re: [SQL] pg_dump fails (timestamp out of range)

2007-02-26 Thread T E Schmitz
Andrew Sullivan wrote: On Mon, Feb 26, 2007 at 11:05:08AM +, T E Schmitz wrote: I can't thank you enough for the above advice. The test above identified 3 records and once they were removed I was able to dump the DB. You'll be wanting to make sure your hardware is fixed after this, don't

Re: [SQL] pg_dump fails (timestamp out of range)

2007-02-26 Thread Andrew Sullivan
On Mon, Feb 26, 2007 at 11:05:08AM +, T E Schmitz wrote: > I can't thank you enough for the above advice. The test above identified > 3 records and once they were removed I was able to dump the DB. You'll be wanting to make sure your hardware is fixed after this, don't forget, or you'll end

Re: [SQL] pg_dump fails (timestamp out of range)

2007-02-26 Thread T E Schmitz
Tom Lane wrote: T E Schmitz <[EMAIL PROTECTED]> writes: pg_dump: ERROR: timestamp out of range pg_dump: SQL command to dump the contents of table "server_hit_bin" failed: PQendcopy() failed. You should treat this as a corrupt-data exercise: you need to identify and fix (or delete) the offen