[HACKERS] why the DB file size does not reduce when 'delete' the data in DB?

2001-03-02 Thread Jaruwan Laongmal
I had deleted a very large number of records out of my SQL table in order to decrease the harddisk space. But after I use command 'ls -l /usr/local/pgsql/data/base/', it is found that the size of concerning files do not reduce due to the effect of 'delete' SQL command. What should I do if I woul

[SQL] Re: [HACKERS] why the DB file size does not reduce when 'delete'the data in DB?

2001-03-02 Thread The Hermit Hacker
On Fri, 2 Mar 2001, Jaruwan Laongmal wrote: > I had deleted a very large number of records out of my SQL table in order to > decrease the harddisk space. But after I use command 'ls -l > /usr/local/pgsql/data/base/', it is found that the size of concerning files > do not reduce due to the effect

[SQL] Help creating rules/triggers/functions

2001-03-02 Thread Blaise Carrupt
Hi all ! I use PostgreSQL 7.0.2 on a HP-UX system. I would like to create a simple function and a simple trigger (or rule) that deny a delete from a table if the row is referenced in another table. I though it should look like this (from my Ingres experience... :) : create function A_del(int4

Re: [SQL] create function w/indeterminate number of args?

2001-03-02 Thread Andrew Perrin
In case anyone else was interested in this issue: I hadn't fully understood the power of the fact that min(int4,int4) was a different function from min(int4,int4,int4). It's not exactly an implementation of an indeterminate number of arguments, but I used the feature to make min() work for any nu

[SQL] Help needed -> ERROR: record arow has no field description

2001-03-02 Thread Justin Clift
Hi all, I'm getting this error, which to me makes no sense. Running PostgreSQL 7.0.3 on Mandrake 7.2 (compiled from source, not the rpms). The code is in a pl/pgsql function I am writing and I can't see why it's complaining. This is the appropriate part of the code : arow

[SQL] Insert into VIEW ???

2001-03-02 Thread Jacek Zagorski
Is it possible to INSERT into xyz where xyz is a view ? What is the proper syntax ? Thanks Much Jacek Zagorski Shasta NetWorks LLC [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate sub

[SQL] SQL copy from csv with explicit field ordering

2001-03-02 Thread Terry Fielder
I guess this is really a SQL question: I have a csv that I want to import, but the csv has different column ordering. I have tried putting the column names in the first row, but then the copy command fails on field which is data type (eg it is seeing the cells in first row as data, not header in

Re: [HACKERS] why the DB file size does not reduce when 'delete' the data in DB?

2001-03-02 Thread Thomas Lockhart
> I had deleted a very large number of records out of my SQL table in order to > decrease the harddisk space. But after I use command 'ls -l > /usr/local/pgsql/data/base/', it is found that the size of concerning files > do not reduce due to the effect of 'delete' SQL command. What should I do >

[SQL] lo_import for storing Blobs

2001-03-02 Thread Laurent
I need to store a binary file in a database. I use a cgi writed in shell to do it. So I can use Postgres user to execute the cgi. How can I store a binary file in a database with a cgi ? Thanks a lot. Laurent. ---(end of broadcast)--- TIP 2: y

[SQL] union & subqueries

2001-03-02 Thread Martin Lillepuu
hello, when I run following sql in 2 separate queries, they work fine. but when used as one beg statement with UNION, I get following error: join_references: variable not in subplan target lists If I remove subqueries, they also work fine. I'm currently using postgres 7.0.2. would upgrading t

[SQL] Re: dates in functions

2001-03-02 Thread Salvador Mainé
The correct function is: CREATE function anyo_hidro (date) returns int AS ' BEGIN RETURN date_part(''month'',$1); END; ' LANGUAGE 'plpgsql'; By the way: Do you know what 'RTFM' means? Salvador Mainé escribió: > > Hello: > > I'm trying to define a function that, given a

[SQL] dates in functions

2001-03-02 Thread Salvador Mainé
Hello: I'm trying to define a function that, given a date, returns its month. The definition is as follows: CREATE function anyo_hidro (date) returns int AS ' BEGIN RETURN date_part("month",$1); END; ' LANGUAGE 'plpgsql'; But when I do: select anyo_hidro('1-1-1999'); I g

RE: [SQL] Help creating rules/triggers/functions

2001-03-02 Thread Sondaar Roelof
Hello Blaise, The following is how I tested your question; DROP SEQUENCE b_id_seq; DROP TABLE b; CREATE TABLE b ( id SERIAL, description TEXT ); INSERT INTO b (description) VALUES('a'); INSERT INTO b (description) VALUES('b'); SELECT * FROM b; D

Re: [SQL] SQL copy from csv with explicit field ordering

2001-03-02 Thread Peter Eisentraut
Terry Fielder writes: > Is there somewhere that I can either enable the first line of CSV as > header names > > OR > > Can I explicitly define my import field ordering from within the select > statement? No and no. You will have to preprocess your file. Something like this will probably do: #

Re: [SQL] Help creating rules/triggers/functions

2001-03-02 Thread Stephan Szabo
If you're only doing a simple check for reference, why not use foreign keys? In general however, you probably want to use plpgsql to define the trigger. And trigger functions don't take parameters in the normal sense, the function should be created taking no args and returning opaque; the para

Re: [SQL] union & subqueries

2001-03-02 Thread Tom Lane
Martin Lillepuu <[EMAIL PROTECTED]> writes: > when I run following sql in 2 separate queries, they work fine. but when > used as one beg statement with UNION, I get following error: > join_references: variable not in subplan target lists AFAICT this works OK in 7.1beta.

[SQL] Database Question

2001-03-02 Thread Tangorre, Michael T.
I have a quick question. Is there a way in ACCESS to get the table names using SQL? Mike ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [HACKERS] why the DB file size does not reduce when 'delete' the data in DB?

2001-03-02 Thread Hannu Krosing
Jaruwan Laongmal wrote: > I had deleted a very large number of records out of my SQL table in order to > decrease the harddisk space. But after I use command 'ls -l > /usr/local/pgsql/data/base/', it is found that the size of concerning files > do not reduce due to the effect of 'delete' SQL com

[SQL] Temp Tables & Connection Pooling

2001-03-02 Thread Gerald Gutierrez
I use PostgreSQL via a connection pooling mechanism, whether it be J2EE or PHP. I've been able to achieve good performance this way, and it has been good to me. Recently I wanted to implement Dijkstra's algorithm as a stored procedure, and finding that PL/PGSQL cannot return record sets, I th

Re: [SQL] Temp Tables & Connection Pooling

2001-03-02 Thread David Olbersen
On Fri, 2 Mar 2001, Gerald Gutierrez wrote: ->Recently I wanted to implement Dijkstra's algorithm as a stored procedure, ->and finding that PL/PGSQL cannot return record sets, I thought about using ->a temporary table for the results. If tempoary tables are session-specific, ->however, then would

Re: [SQL] Help needed -> ERROR: record arow has no field description

2001-03-02 Thread Tom Lane
Justin Clift <[EMAIL PROTECTED]> writes: > I'm getting this error, which to me makes no sense. Running PostgreSQL > 7.0.3 on Mandrake 7.2 (compiled from source, not the rpms). > ERROR: record arow has no field description Hm. If you don't have any references to "arow.description" then this se