Re: [SQL] How to declare cursor if tablename is a variable?

2007-03-19 Thread Michael Fuhr
[Please copy the mailing list on replies so others can participate in and learn from the discussion.] On Tue, Mar 20, 2007 at 02:28:15AM +, hu js wrote: > It doesn't work. Because can't use variable for table name in query. > > Please tell me another way. Thanks What exactly have you tried t

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Paul Lambert
Phillip Smith wrote: Maybe use char 254 or 253 or something similar... Anything that isn't going to be found in the file. Have you tried using a string as a delimiter? QUOTE 'THIS.STRING.ISNT.IN.THE.TEXT.FILE' ~p I changed it to QUOTE '\f' to set the quote character to form-feed which is

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Michael Fuhr
On Tue, Mar 20, 2007 at 11:25:38AM +0900, Paul Lambert wrote: > I note an option in the COPY command to specify the quote character, > defaulting to double quote. The problem being a single quote will also > be used in the data, as will other characters. Is there any way to get a > copy to have

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Phillip Smith
Maybe use char 254 or 253 or something similar... Anything that isn't going to be found in the file. Have you tried using a string as a delimiter? QUOTE 'THIS.STRING.ISNT.IN.THE.TEXT.FILE' ~p On Tue, 2007-03-20 at 11:59 +0900, Paul Lambert wrote: > Andrej Ricnik-Bay wrote: > > On 3/20/07, Paul

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Paul Lambert
Andrej Ricnik-Bay wrote: On 3/20/07, Paul Lambert <[EMAIL PROTECTED]> wrote: The source file comes from extracts on our main application which sits inside an in-house pretending-to-be-a-dbms file system. The content of these extracts would be difficult to change - the extract program would need

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Andrej Ricnik-Bay
On 3/20/07, Paul Lambert <[EMAIL PROTECTED]> wrote: The source file comes from extracts on our main application which sits inside an in-house pretending-to-be-a-dbms file system. The content of these extracts would be difficult to change - the extract program would need to parse the data looking

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Paul Lambert
Phillip Smith wrote: Can you not export the source file with escape characters? ie, ^17\" Alloy Wheels^ ~p The source file comes from extracts on our main application which sits inside an in-house pretending-to-be-a-dbms file system. The content of these extracts would be difficult to chan

Re: [SQL] Issue with copying data from a text file.

2007-03-19 Thread Phillip Smith
Can you not export the source file with escape characters? ie, ^17\" Alloy Wheels^ ~p On Tue, 2007-03-20 at 11:25 +0900, Paul Lambert wrote: > I have a procedure in place that copies data from a caret delimited text > file into a table storing some information. > > One of the fields in the t

[SQL] Issue with copying data from a text file.

2007-03-19 Thread Paul Lambert
I have a procedure in place that copies data from a caret delimited text file into a table storing some information. One of the fields in the table contains an item description which may contain item dimensions such as - 17" alloy wheels The problem I am getting when I do my load is I believe

Re: [SQL] triple self-join crawling

2007-03-19 Thread Martin Marques
T E Schmitz escribió: QUERY PLAN GroupAggregate (cost=1370368.19..1435888.88 rows=5801 width=56) (actual time=11945.030..13163.156 rows=5801 loops=1) -> Sort (cost=1370368.19..1379715.86 rows=3739067 width=56) (actual time=11944.753..12462.623 rows=120117 loops=1) Sort Key: histo

Re: [SQL] [ADMIN] create view with check option

2007-03-19 Thread Karthikeyan Sundaram
Hi everybody, I have implemented in a different way as advised in the manual. I thought this will be useful for everbody. We don't have check option in the view. Instead we can create a rule to make the view as insertable, updatable or delete. Here is the script. create table test_t

Re: [SQL] Encode

2007-03-19 Thread Jure Kodzoman
On Mon, 2007-03-19 at 09:21 -0300, Ezequias R. da Rocha wrote: > Hi list, > > It is possible to change the Encode of one database while it is on ? > > Sincerely > Ezequias No it isn't. You would have to drop and recreate an entire DB for that. But it's possible to change encoding of your client

Re: [SQL] triple self-join crawling

2007-03-19 Thread T E Schmitz
Andrew Sullivan wrote: Define "crawling". Also, please post EXPLAIN and, if feasible, Total runtime: 191430.537 ms EXPLAIN ANALYSE output for your case. On Sun, Mar 18, 2007 at 07:51:28PM +, T E Schmitz wrote: The following self join of a table containing 5800 records is crawling:

Re: [SQL] triple self-join crawling

2007-03-19 Thread T E Schmitz
T E Schmitz wrote: T E Schmitz wrote: Things improved hugely when I changed the JOIN clauses: see explain analyze below - can this be improved further? LEFT OUTER JOIN history AS past_month ON (past_month.stock = history.stockAND past_month.day >= (history.day - 30) AND past_month

[SQL] Multiple partition tables and faster queries

2007-03-19 Thread Maya Nigrosh
We've got three master tables: email, machines, and dests--each with seven partition tables apiece. Each partitioned table is constrained to contain only a single day's worth of data, with a CHECK contstraint of the form CHECK ( ***Timestamp >= 'start_constraint' AND ***Timestamp < 'st

Re: [ADMIN] [SQL] create view with check option

2007-03-19 Thread Tom Lane
"hubert depesz lubaczewski" <[EMAIL PROTECTED]> writes: > On 3/19/07, Tom Lane <[EMAIL PROTECTED]> wrote: >>> ERROR: WITH CHECK OPTION is not implemented >> It seems perfectly clear to me ... > errors is clear, but maybe the information about check option should > be removed from docs to 8.2? The

Re: [SQL] Encode

2007-03-19 Thread Shoaib Mir
For that you will need to drop and re-create it with a different encoding -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 3/19/07, Ezequias R. da Rocha <[EMAIL PROTECTED]> wrote: Hi list, It is possible to change the Encode of one database while it is on ? Sincerely Ezequias --

[SQL] Encode

2007-03-19 Thread Ezequias R. da Rocha
Hi list, It is possible to change the Encode of one database while it is on ? Sincerely Ezequias ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] triple self-join crawling

2007-03-19 Thread T E Schmitz
T E Schmitz wrote: The following self join of a table containing 5800 records is crawling: SELECT history.stock, history.day, history.high, history.low, MAX(past_week.high) AS week_high, MAX(past_month.high) AS month_high FROM history INNER JOIN history AS past_month ON (past_month.s

Re: [SQL] triple self-join crawling

2007-03-19 Thread Andrew Sullivan
Define "crawling". Also, please post EXPLAIN and, if feasible, EXPLAIN ANALYSE output for your case. A On Sun, Mar 18, 2007 at 07:51:28PM +, T E Schmitz wrote: > The following self join of a table containing 5800 records is crawling: > > CREATE TABLE history > ( > stock VARCHAR(30) NOT