Re: [SQL] Calendar Scripts - Quite a complex one

2004-01-08 Thread Chris Travers
Hi Kumar and others; I have never worked with functions to return references to cursors. Is there a reason why it has to be done this way rather than returning a setof appointments? In that case: create function app_today returns setof appointment (date) as ' declare new_appoint appointment;

[SQL] Start-up problems

2004-01-08 Thread beyaRecords - The home Urban music
I am running postgresql 7.4.1 on OS X 10.3 and am having to manually start-up postgresql using /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data. Is there a script available which will enable me to automate this process, so that postgres loads up at startup? Uzo

Re: [SQL] Start-up problems

2004-01-08 Thread Johannes Lochmann
On Thursday 08 January 2004 13:59, beyaRecords - The home Urban music wrote: > I am running postgresql 7.4.1 on OS X 10.3 and am having to manually > start-up postgresql using /usr/local/pgsql/bin/postmaster -i -D > /usr/local/pgsql/data. > > Is there a script available which will enable me to auto

Re: [SQL] Start-up problems

2004-01-08 Thread Kaloyan Iliev Iliev
Look at /etc/ beyaRecords - The home Urban music wrote: Kaloyan, thanks for reply. Still finding my way around the unix environment so could you tell me where the file you mention is situated? On 8 Jan 2004, at 13:24, Kaloyan Iliev Iliev wrote: This is what I have in my rc.local on FreeBSD: su

[SQL] COPY command

2004-01-08 Thread azwa
Hi,   i try to load a file into temporary table but it gives me an error . do u have any idea/solutions ??  the command that i've running as below :     dwnc=# copy biosadm.custdo_temp dwnc-# from '/home/bios/customer_data/CustomerDO_new.CSV' dwnc-# WITH DELIMITER ',' ; ERROR:  copy: line 1

[SQL] grouping by date

2004-01-08 Thread teknokrat
How can I group by date given a timestamp column? thanks ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] unix time -> timestamp

2004-01-08 Thread boyd
In article <[EMAIL PROTECTED]>, boyd <[EMAIL PROTECTED]> wrote: > I'm pretty sure in 7.0 postgres, (but I may be wrong) you could insert > directly from a perl script something like this: >$time = time; # this gives epoch seconds >$sql = "insert into mytable values(..., timestamp($time),

[SQL] COPY command

2004-01-08 Thread azwa
Hi, i try to load a file into temporary table but it gives me an error . do u have any idea/solutions ?? the command that i've running as below : dwnc=# copy biosadm.custdo_temp dwnc-# from '/home/bios/customer_data/CustomerDO_new.CSV' dwnc-# WITH DELIMITER ',' ; ERROR: copy: line 14

Re: [SQL] Different query results in psql and Perl DBI with Postgres 7.2.1

2004-01-08 Thread boyd
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Brendan LeFebvre) wrote: > I have a script that updates one record in a PostgreSQL 7.2.1 database > through the Perl DBI. > > Where do I even begin to attempt a diagnosis? Here is the output from a script I ran with no problems under 7.2.1, f

[SQL] question : the choice of the primary key.

2004-01-08 Thread Loeke
U have for example something like this create table persons( (id..), surename .., familyname .., street .., .., birthdate,.. ) a table containing the data of persons, each persons should of course be present only once; and one should still define a primary key, there are two options now, 1.many p

[SQL] Different query results in psql and Perl DBI with Postgres 7.2.1

2004-01-08 Thread Brendan LeFebvre
I have a script that updates one record in a PostgreSQL 7.2.1 database through the Perl DBI. Here is the output from my log, which outputs the query sent to the DBI and the return value: --- Update query: UPDATE item SET status='SOLD' WHERE item_id=1129832 1 rows affected. Update query: UPDATE

Re: [SQL] question : the choice of the primary key.

2004-01-08 Thread Loeke
> 1.many people make an extra id field and choose this id field to be the > p-key, > but then the same person can be present twice in the table (with different > id fields), the id in itself has no real meaning > 2.or u can choose the "natural" key for each person, lets say a name and the > birthda

[SQL] unix time -> timestamp

2004-01-08 Thread boyd
I'm pretty sure in 7.0 postgres, (but I may be wrong) you could insert directly from a perl script something like this: $time = time; # this gives epoch seconds $sql = "insert into mytable values(..., timestamp($time), ...) "; And then the $sql string would run with the DBI call, etc. Wh

[SQL] PostgreSQL Array Syntax

2004-01-08 Thread Evan Klinger
Good afternoon. I am attempting to create a PHP script that inserts values into a PostgreSQL database, where some of the columns are two dimensional arrays. I read the docs and it says that array elements must be matched and that is what I am confused about. Does that mean that ARRAY[['eng_lab

[SQL] data loading

2004-01-08 Thread azwa
Hi,   i try to load data from flat file (comma delimiter format) into temporary table . i use COPY command as below: dwnc=# copy biosadm.custdo_temp dwnc-# from '/home/bios/customer_data/CustomerDO_new.CSV' dwnc-# WITH DELIMITER ',' ; ERROR:  copy: line 141, Extra data after last expected

[SQL] Date select question...

2004-01-08 Thread Lance Munslow
I have the following table: Table "public.test" Column | Type | Modifiers ---+--+--- test_date | date | with the following data: test_date 2004-10-31 2004-11-01 (2 rows) Why does the query: select * from test where test_date between '20041001' and

Re: [SQL] COPY command

2004-01-08 Thread Gregory S. Williamson
This sounds as if the last character in each line might be a delimiter (a ",") which is standard for data unloaded from some sources; if this is the case try removing it and your data should load. Or you may have a comma in a character field and that is throwing off the count for the line in que

Re: [SQL] COPY command

2004-01-08 Thread azwa
Hi , yes now i can do the copy after replace comma delimiter with tab delimiter which is default copy with delimiter . btw  i've another question : how do we run the COPY command from file which has several null columns in each field.   thanks. example :    dwnc=# copy biosadm.custinv_te

Re: [SQL] COPY command

2004-01-08 Thread Michael Glaesemann
On Jan 9, 2004, at 1:11 PM, [EMAIL PROTECTED] wrote: how do we run the COPY command from file which has several null columns in each field.   thanks. example :    dwnc=# copy biosadm.custinv_temp dwnc-# from '/home/bios/customer_data/CustomerInvoice_5Dec03_tab.txt' ; ERROR:  copy: line 1, Missing

Re: [SQL] grouping by date

2004-01-08 Thread Robert Creager
When grilled further on (Mon, 05 Jan 2004 17:14:26 +), teknokrat <[EMAIL PROTECTED]> confessed: > How can I group by date given a timestamp column? > I just found this out this weekend. Try 'date_trunc'. Look at secion 9.8.2 of the documentation. I'm using something like: SELECT date_tru

Re: [SQL] Date select question...

2004-01-08 Thread Tom Lane
Lance Munslow <[EMAIL PROTECTED]> writes: > [ why do these act differently: ] > select * from test where test_date between '20041001' and '20041101'; > select * from test where test_date between 20041001 and 20041101; In the latter case the constants are integers, not dates. IMHO the best policy