Re: [SQL] data import

2010-12-21 Thread Chris Ruprecht
If your file is TAB delimited, you can simply do: \copy tablename from 'some file' To get details in psql, do: psql mydatabase and at the prompt: \h copy On Dec 21, 2010, at 06:34 , Viktor Bojović wrote: > Hi, > > can anyone recommend me a windows and linux free tools for importing data > i

[SQL] Create/update trigger auto-populate fields.

2010-12-16 Thread Chris Ruprecht
Hey guys, To start, I need to mention that I did read chapter 39-3 on triggers and do understand how they work, in the current (9.0) manuals (OK, maybe the manuals are RC1, but the content is the same as in 8.4... :). I have a simple table, person: pe_id | bigint | not n

[SQL] Variable number or arguments to a function possible?

2009-04-24 Thread Chris Ruprecht
wnes the phone and so on. How would I declare that function? Thanks. best regards, chris -- chris ruprecht database grunt and bit pusher extraordinaíre -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql

Re: [SQL] Last record

2002-07-24 Thread Chris Ruprecht
Select * from where <...> desc limit 1; Desc = from the bottom up, limit 1 = just one record. Best regards, Chris On Wednesday 24 July 2002 10:36 am, Leao Torre do Vale wrote: > Dear Sir, > > If you already have the answer of the question below please, send to me. > > Best Regards > > Leao > >

[SQL] Search by longitude/latitude

2001-10-08 Thread Chris Ruprecht
Hi all, I need to implement "Find all hospitals in a 5 mile radius". Say I have all the coordinates on them stored in a table with the fields longitude and latitude. Has anybody some sample code for that? Best regards, Chris _ Do You Yah

Re: [SQL] Selecting latest value II

2001-09-20 Thread Chris Ruprecht
what about using 'distinct' in you select statement? - Original Message - From: "Haller Christoph" <[EMAIL PROTECTED]> To: "Patrik Kudo" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, September 20, 2001 11:02 AM Subject: Re: [SQL] Selecting latest value II > What do you mea

[SQL] More on the TO DO wishlist

2001-09-03 Thread Chris Ruprecht
I did some pl/pgsql this morning and forgot a ';' at the end of a line. The result was, that the compiler complained about a wrong statement in line 304 - which is at the end of the program. The other error I made was that I used a new record without defining the record first. This, the program on

Re: [SQL] Temp tables being written to disk. Avoidable? [Another TO-DO]

2001-08-24 Thread Chris Ruprecht
(Maybe this thread is dead now, but here goes anyway) Suggestion: have an environment variable or a PostgreSQL parameter to indicate where to write the temp-table to. This way, you could easily direct it to a RAM disk (if small enough) or to a drive other than your main database. Default could be

Re: [SQL] Functions returning more than one value

2001-08-08 Thread Chris Ruprecht
s is going to slow down my program'. But this reminds me: where are temp tables kept? On disk or in memory? - that might be a way out of the dilemma. Best regards, Chris - Original Message - From: "Josh Berkus" <[EMAIL PROTECTED]> To: "Chris Ruprecht" <

[SQL] Functions returning more than one value

2001-08-08 Thread Chris Ruprecht
Hi all, How can I get more than one value back from a function? I have a situation here, where a function needs to return a value - but also needs to indicate from which type of record the value comes. The most elegant would be something like the 2 functions listed below. They don't work, since

Re: [SQL] More Database Design Stuff

2001-08-02 Thread Chris Ruprecht
Well, consider this: You have a customer list, each customer with his own unique customer number. Each of your customers has at least one address but some of them have 2 or more. Therefore, you have to create two tables, say one is called 'cust' the other 'cust_addr'. The 'cust_addr' table now ne

Re: [SQL] Big table - using wrong index - why?

2001-07-30 Thread Chris Ruprecht
m ... Best regards, Chris - Original Message - From: "Joe Conway" <[EMAIL PROTECTED]> To: "Chris Ruprecht" <[EMAIL PROTECTED]>; "pgsql" <[EMAIL PROTECTED]> Sent: Monday, July 30, 2001 11:43 AM Subject: Re: [SQL] Big table - using wrong index - why

[SQL] Big table - using wrong index - why?

2001-07-30 Thread Chris Ruprecht
Hi all, I have a table with about 6 million records in it. I have 9 different indexes on the table (different people need to access it differently) If you look at the details below, you can see that it's selecting an index which doesn't have the fields I'm searching with - and it takes for ever.

Re: [SQL] Full-text Indexing and Primary Keys

2001-07-23 Thread Chris Ruprecht
Josh, Full Text Indexing It will allow you to store text into a database and find portions of this text again, based on a few words of the text in the record. Say, for example, you want to store the bible in a PostGres database. You will store these fields: 1. Book 2. Chapter 3. Verse 4. Verse t

Re: [SQL] TODO List

2001-07-20 Thread Chris Ruprecht
e one or other thing. I'd love to see pl/pgsql develop into what I saw the other day in the Oracle PL/SQL book.. Best regards, Chris - Original Message - From: "Josh Berkus" <[EMAIL PROTECTED]> To: "Bruce Momjian" <[EMAIL PROTECTED]>; "Chris Ru

[SQL] TODO List

2001-07-20 Thread Chris Ruprecht
Bruce, while you're at TO-DO list additions: I'd like to have a construct like: loop if then next [loop]; end if; [more statements] end loop; I want to be able to skip to the next iteration of the loop, if a certain condition is met but I do not want to exit the loop all tog

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ...:)

2001-07-17 Thread Chris Ruprecht
Hi Josh, on 07/17/2001 18:31, Josh Berkus at [EMAIL PROTECTED] wrote: > Chris, > > Hmmph. People are in a bad mood this week; obviously few other people > on the list have had to write applications for the banking industry, > which trades everything in flat files. Give Chris a break! > Than

Re: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ...:)

2001-07-17 Thread Chris Ruprecht
o a temp record, which I then cut to pieces, extracting the info I want. Once I have what I need to create the actual record, I can delete the temp record. Best regards, Chris on 07/17/2001 16:06, Tom Lane at [EMAIL PROTECTED] wrote: > "Chris Ruprecht" <[EMAIL PROTECTED]> wr

[SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Chris Ruprecht
Hi all, I need to know how I can access a flat file from within a PL/PGSQL script. I have an Oracle PL/SQL book here and they refer to FOPEN(...), FCLOSE(...) but these functions don't seem to exist in PL/PGSQL.. What can I do instead? I checked the Programmer's Guide to Procedural Languages (Pos

[SQL] First steps in plpgsql - language not recognized?

2001-07-17 Thread Chris Ruprecht
Hi all, I have tried (and failed) my first steps in Pl/PgSQL. This must be real simple (like a 'create language' or something) but I don't (yet) know how to do this and maybe someone has a quick answer for me here. I get this (I'm sure it's a clear case of RT(F)M, but there are so many Ms to R, I

[SQL] Unknown values in int8 fields?

2001-07-15 Thread Chris Ruprecht
Hi Chris, When I load records with copy from ... And one of the fields (last one) is left empty, I want the default of nextval('sequence_table') to kick in - but it doesn't. Now, the field with a unique index on it stays blank. No big deal if I could go and say 'update rate set recno = nextval('

Re: [SQL] rpt

2001-06-12 Thread Chris Ruprecht
Hilkiah, you could use any report writing tool which connects to databases via ODBC. Download the Windows ODBC driver and install it. Set the '-i' flag on the postmaster, set up the ODBC interface to PostGreSQL in Windows and you're ready to fly :). Best regards, Chris - Original Message --

[SQL] Re: [PHP] PHP-PostgreSQL - install

2001-06-05 Thread Chris Ruprecht
find libpq.so.2.1 in the tree from the compile (find . -name libpq.so.2.1 -print) then copy it to /usr/libexec manually. you might also want to check the permissions on the library, it should be 755 (rwxr-xr-x). Best regards, Chris - Original Message - From: "Dorin Grunberg" <[EMAIL PROT

Re: [SQL] Unique record Identifier?

2001-05-30 Thread Chris Ruprecht
on 05/30/2001 16:33, Josh Berkus at [EMAIL PROTECTED] wrote: > Chris, > Thanks Josh - that was my next step. At the moment, the database is not in production, I'm running a Progress database there, but I'm trying to learn the dos and don'ts in PG. I don't really need to backfill the records, I

[SQL] Unique record Identifier?

2001-05-30 Thread Chris Ruprecht
Hi all, I'm busy writing an application using PostGreSQL and PHP, so my db reads are 'stateless' and I don't know at record 'write' time which record I have read to begin with. The records I have, have an index, most tables do have a unique index but the index values could get changed during an u

[SQL] Stored Procedures?

2001-05-24 Thread Chris Ruprecht
I read something about stored procedures in the Great Bridge User's Manual (Page 74 under "PG_LANGUAGE"). It is only mentioned briefly and there are no explanations of how it works. Can anybody let me know, how I can write a stored procedure and how to run it? Best regards, Chris

[SQL] Select question

2001-05-23 Thread Chris Ruprecht
Hi all, although not new to databases, I'm new to the wonderful world of PostGreSQl and SQL in general. Question: I do this query phone=# select * from phonelog where cdate > 2001-05-18 order by cdate limit 2 ; And I get theis result cdate| ctime | countrycode | success | carrier | dura