Re: [SQL] strange query execution times

2001-10-04 Thread Markus Bertheau
On Tue, 2001-10-02 at 17:49, Tom Lane wrote: > Markus Bertheau <[EMAIL PROTECTED]> writes: > > r_kunden_anbieter describes the relationship between customers and > > suppliers. there are five status, 0 to 4 in attribute beziehung. both > > queries return the same results. they select all customers

Re: [SQL] Alias Join Table

2001-10-04 Thread Josh Berkus
Keith, There are a number of posts and papers on tree structures , both in the SQL list archives, and on Roberto Mello's resources at techdocs.postgresql.org. -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete informati

Re: [SQL] Indexing behavior

2001-10-04 Thread Ross J. Reedstrom
On Tue, Oct 02, 2001 at 09:47:09AM -0700, Josh Berkus wrote: > Folks, > > Q: Are brand-new rows included in PostgreSQL indexed immediately? > A: Yes, and that's why you don't add indices willy-nilly to all possible column combos on any given table: INSERTs get real slow. Ross ---

Re: [SQL] ORDER BY case insensitive?

2001-10-04 Thread Tom Lane
Keith Gray <[EMAIL PROTECTED]> writes: > How would PostgreSQL know to use the index > MyTable_lower_idx when I do a ... > SELECT * FROM MyTable WHERE lower(name) LIKE 'jas%'; The same way it knows to use any other index: it matches up the things mentioned in the WHERE clause with the available i

Re: [SQL] ORDER BY case insensitive?

2001-10-04 Thread Keith Gray
Jason Earl wrote: > > You can, however, create an index like: > > create index MyTable_lower_idx on MyTable > (lower(name)); > > It won't help with your particular query, but it > certainly would help for queries like: > > SELECT * FROM MyTable WHERE lower(name) = 'jason'; > How would Postgr

Re: [SQL] Beginner's List

2001-10-04 Thread Keith Gray
Josh Berkus wrote: > > To help remedy this, ... > Can anyone suggest something? > Could we set-up a forum with a product like Request Tracker where a group of experienced users could take questions from a web-based queue? -- Keith Gray Technical Development Manager Heart Consulting Services

[SQL] Alias Join Table

2001-10-04 Thread Keith Gray
If I have the following 'Hierachy' table... Child | Parent -- 1 | 0 2 | 1 3 | 1 4 | 3 5 | 4 6 | 3 7 | 4 How do I return a list 5,4,3,1 ? SELECT a.Child FROM Hierachy AS a, Hierachy AS b WHERE a.Parent = b.Child AND a.Child = 5; ... is obviously a

Re: [SQL] Need Help!!

2001-10-04 Thread Ross J. Reedstrom
On Mon, May 21, 2001 at 07:39:06PM +0530, Gurudutt wrote: > Hello pgsql-sql, > > I am the new member for the postgres mailing list. Actually I have > been working with mysql, php and perl for a very long time now, and > offlate shifted to pgsql. I have many technical difficulties > > 2.

Re: [SQL] ORDER BY case insensitive?

2001-10-04 Thread Stephan Szabo
On Thu, 4 Oct 2001, Jason Earl wrote: > My guess is that compared to the task of sorting > millions of names the fact that you have to lowercase > them first is not going to be a particular burden. No > matter what you do you are going to get a table scan > (unless you qualify your select with a

Re: [SQL] ORDER BY case insensitive?

2001-10-04 Thread Jason Earl
My guess is that compared to the task of sorting millions of names the fact that you have to lowercase them first is not going to be a particular burden. No matter what you do you are going to get a table scan (unless you qualify your select with a where clause). You can, however, create an inde

Re: [SQL] Function return rows?

2001-10-04 Thread Allan Engelhardt
Pat M wrote: > Can I use a function to execute a query and return a row or set of rows? No. Consider using temporary tables if you must do this. > If > so, can you point me to some examples or perhaps give me an example of a > function that would do roughly the same thing as: > > select * from

Re: [SQL] how can i return multiple values from a function

2001-10-04 Thread Allan Engelhardt
Try using temporary tables. Functions can't return tables and, it would seem, SETOFs. srinivas wrote: > i have tried retrieving multiple values using setof function but i > couldnt solve it.when i am trying using setof iam getting this as > output. > > > 1 CREATE FUNCTION hobbies (varchar

Re: [SQL] to_date/to timestamp going to BC

2001-10-04 Thread jason . servetar
Thanks Karel, Good call, you guessed it. I was just using my Oracle knowledge of the to_date and applying it to the results I was expecting in pgsql. Guess I should not make those assumptions -Original Message- From: Karel Zak [mailto:[EMAIL PROTECTED]] Sent: Thursday, October

Re: [SQL] ORDER BY case insensitive?

2001-10-04 Thread Jason Earl
SELECT * FROM MyTable ORDER BY lower(Name); Should do the trick. Jason Earl --- Bob Swerdlow <[EMAIL PROTECTED]> wrote: > How do I get the rows sorted in a case insensitive > way? > > I have some queries that basically fit the form: > SELECT * FROM MyTable ORDER BY Name; > When I view the

Re: [SQL] Beginner's List

2001-10-04 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: > A new PostgreSQL user pointed out to me that there is nobody currently > on the pgsql-beginner list with any depth of experience. You mean pgsql-novice, no? There are a number of hackers answering questions pretty regularly on that list... > To help r

Re: [SQL] [PHP] Need Help!!

2001-10-04 Thread Heather Johnson
Hi Gurudutt-- Concerning #1, I had a similar problem when porting data from mysql to psql. I finally ended up just using mysql's COPY command to get the data into delimited text form, then imported that into psql using its COPY command. This seems to me to be the easiest way to port over data if

Re: [SQL] select 5/2???

2001-10-04 Thread Lee Harr
> > I run select 5/2 = 2 > who to get "2.5" > integer/integer = integer float/integer = float integer/float = float integer/integer::float = float test=# SELECT 5.0/2; ?column? -- 2.5 (1 row) test=# SELECT 5/2::float; ?column? -- 2.5

[SQL] challenging query

2001-10-04 Thread Chris Ruffin
Consider the following table: A B C D select? --- 1 FOO A1 100 n 1 BAR Z2 100 n 2 FOO A1 101 y 2 BAR Z2 101 y 3 FOO A1 102 y 4 BAR Z2 9

[SQL] select 5/2???

2001-10-04 Thread guard
dear all I run select 5/2 = 2 who to get "2.5" thanks -- ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

[SQL] ORDER BY case insensitive?

2001-10-04 Thread Bob Swerdlow
How do I get the rows sorted in a case insensitive way? I have some queries that basically fit the form: SELECT * FROM MyTable ORDER BY Name; When I view the results, all of the Name's that start with an upper case letter precede all of the Name's that start with a lower case letter. I want

Re: [SQL] temporary views

2001-10-04 Thread Bruce Momjian
> Hi > I have simple question: How to create view on a temporary table? > I need this, because pl/pgsql function returns data via temporary table. > > View created on a temporary table is useful only to the end of session. > Next time i create the same temp table i get > "Table xxx with oid xxx

Re: [SQL] Beginner's List

2001-10-04 Thread Stephan Szabo
On Thu, 4 Oct 2001, Josh Berkus wrote: > A new PostgreSQL user pointed out to me that there is nobody currently > on the pgsql-beginner list with any depth of experience. As a result, > most posts there go answered with an "Uh ... I dunno either." or even > misinformation. > > To help remedy th

[SQL] Beginner's List

2001-10-04 Thread Josh Berkus
Folks, A new PostgreSQL user pointed out to me that there is nobody currently on the pgsql-beginner list with any depth of experience. As a result, most posts there go answered with an "Uh ... I dunno either." or even misinformation. To help remedy this, I would like to take 1 beginner question

[SQL] temporary views

2001-10-04 Thread Tomasz Myrta
Hi I have simple question: How to create view on a temporary table? I need this, because pl/pgsql function returns data via temporary table. View created on a temporary table is useful only to the end of session. Next time i create the same temp table i get "Table xxx with oid xxx doesn't exist

Re: [SQL] SQL Syntax / Logic question

2001-10-04 Thread Josh Berkus
Mike, > select frienda, friendb from friends where (select > schools.school from friends,schools where friends.frienda = > schools.person) = (select schools.school from friends,schools where > friends.friendb = schools.person); Too complicated. You need to learn how to use JOINS and table alias

Re: [SQL] to_date/to timestamp going to BC

2001-10-04 Thread Karel Zak
On Thu, Oct 04, 2001 at 07:44:14AM -0700, Josh Berkus wrote: > Karel, > > > .. well, I add it to my TODO for 7.3 (I plan rewrite several things > > in to_* functions). > > How about a to_char function for INTERVAL? Please, oh please? oh, needn't please.. already in right now breeding 7.2 :-)

Re: [SQL]maximum parameters limit to function & manipulating array in plpgsql

2001-10-04 Thread Josh Berkus
Advid, > Well I read one of ur solutions to sending more tham 16 parameters to > a function in plpgsql. I have changed the value of FUNC_MAX_ARGS > (a/k/a INDEX_MAX_KEYS) in \usr\local\plpgsql\include\config.h after > stoping the postmaster service. > On restarting the service after having chang

Re: [SQL] to_date/to timestamp going to BC

2001-10-04 Thread Josh Berkus
Karel, > .. well, I add it to my TODO for 7.3 (I plan rewrite several things > in to_* functions). How about a to_char function for INTERVAL? Please, oh please? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete infor

[SQL] SQL Syntax / Logic question

2001-10-04 Thread Michael D. Harlan
I've been working on this SQL problem for about 12 days now and have asked for help from friends/colleagues, but haven't found a solution. I send it to this list as a last resort. Let's say I have a table called "friends" and in this table, I have the following data: FriendA FriendB --- -

[SQL] Need Help!!

2001-10-04 Thread Gurudutt
Hello pgsql-sql, I am the new member for the postgres mailing list. Actually I have been working with mysql, php and perl for a very long time now, and offlate shifted to pgsql. I have many technical difficulties 1. I need to port mysql data to pgsql. I tried both mysql2pg.pl and my2pg

Re: [SQL]

2001-10-04 Thread Christopher Sawtell
On Thu, 04 Oct 2001 01:55, postgresql wrote: > Please can someone help > > I tried to subccribe to pgsl-admin but I have been unable. > > I just upgraded to Mac osx 10.1. When I try to configure --with-tcl I get > an error that 'wish' can not be found. Where do I get this? (this is not so > i

Re: [SQL] to_date/to timestamp going to BC

2001-10-04 Thread Karel Zak
On Wed, Oct 03, 2001 at 05:14:02PM -0400, Tom Lane wrote: > [EMAIL PROTECTED] writes: > > Can someone tell me if this is a bug with the date functions or am I using > > them incorrectly? > > I get the right thing when I use the right format: > > regression=# select dt, to_timestamp(dt, 'FMMonth