Re: [SQL] Query On Case structure

2001-10-23 Thread Haller Christoph
Hi All, Can we create a query to find different values based on different criteria = from a table using case structure. For example Select Into :DBComment Case When localComment Is Null Then Comment When localComment = '123' Then 'Numeric Comment'

Re: [SQL] Diferent databases on same query...

2001-10-23 Thread chrup
Andre, The only reason to have data for one query in different databases is if the databases are on different machines. If you're running on PC-type hardware, you might have to do that some times for performance reasons. But if at that point, you should ask yourself if you shouldn't invest in

Re: [SQL] Auto Increment

2001-10-23 Thread Josh Berkus
Mayuresh, First, beginner's questions belong on the PGSQL-NOVICE list. could anyone tell me how to make a primary key to AUTO INCREMENT. The document is not exactly very explainatory about it :) No, it is quite clear. See: http://www.postgresql.org/idocs/index.php?datatype.html section

Re: [SQL] can't update 'c:\windows'

2001-10-23 Thread Josh Berkus
Guard, First, this kind of beginner question is more appropriate for the NOVICE list. IF update table set field='c:\windows' but c:\windows - c:windows That's because \ is the Unix escape character. If I were to want to save O'Reilly, for example, I could: UPDATE table SET name =

Re: [SQL] Index of a table is not used (in any case)

2001-10-23 Thread Tom Lane
Reiner Dassing [EMAIL PROTECTED] writes: explain select * from wetter order by epoche desc; NOTICE: QUERY PLAN: Index Scan Backward using wetter_epoche_idx on wetter (cost=0.00..3216018.59 rows=2034 width=16) explain select * from wetter where epoche between '1970-01-01' and

[SQL] Error codes as numbers or in other languages etc.

2001-10-23 Thread Aasmund Midttun Godal
I have seen several people asking about getting error numbers or similar things out of postgres. The way I have done this is as follows: CREATE TABLE errors ( errorstring TEXT PRIMARY KEY, message TEXT ); INSERT INTO errors VALUES ('^FATAL 1: Database ([^\]+) does not exist in

Re: [SQL] [HACKERS] Index of a table is not used (in any case)

2001-10-23 Thread Christopher Kings-Lynne
Hello PostgreSQl Users! PostSQL V 7.1.1: You should upgrade to 7.1.3 at some point... I have defined a table and the necessary indices. But the index is not used in every SELECT. (Therefore, the selects are *very* slow, due to seq scan on 20 million entries, which is a test setup up to

[SQL] PL/pgSQL triggers ON INSERT OR UPDATE

2001-10-23 Thread san
Hello, I'm trying to set up a trigger on insert or update but when using the predefined variable ``OLD'' I get a NOTICE from the trigger function about OLD not being defined yet. Of course OLD is not defined when the function is triggered on INSERT event, and I did not mention it if not inside a

Re: [SQL] [HACKERS] Index of a table is not used (in any case)

2001-10-23 Thread Doug McNaught
Reiner Dassing [EMAIL PROTECTED] writes: Hello PostgreSQl Users! PostSQL V 7.1.1: I have defined a table and the necessary indices. But the index is not used in every SELECT. (Therefore, the selects are *very* slow, due to seq scan on 20 million entries, which is a test setup up to

Re: [SQL] pgsql embedded again!

2001-10-23 Thread Haller Christoph
Hi Esteban, Your problem looks familiar to me, and it seems you did not follow my advice. Anyway, here is a C sample program which works. It has nothing to do with wrong types, but with a missing connection, but see for yourself. /* /opt/pgsql/bin/ecpg -o sampleprog01.c sampleprog01.sql

Re: [SQL] Diferent databases on same query...

2001-10-23 Thread Troy
Just my two cents on the issue: A good reason would be having several databases which each use the same set of tables which contain some information which takes a lot of storage, such as dictionaries or map information. You wouldn't want to maintain several copies of 500 Mb tables, especially

Re: [SQL] Deleting obsolete values

2001-10-23 Thread Pat M
Delete from partitur where userid NOT IN (SELECT DISTINCT ON (userid) userid, val, ts FROM partitur) Haller Christoph [EMAIL PROTECTED] wrote in message 200110161445.QAA11833@rodos">news:200110161445.QAA11833@rodos... This may look familiar to you - it was on the list last month. Consider the

Re: [SQL] system maintained keys

2001-10-23 Thread Stefan Lindner
Thank you very much! Thanks to all who answered! An I will never again ask silly questions here :-) Stefan Lindner [EMAIL PROTECTED] schrieb im Newsbeitrag 9qf06v$20bh$[EMAIL PROTECTED]">news:9qf06v$20bh$[EMAIL PROTECTED]... Is there any way to get system maintained keys from postgres? e.g. to

[SQL] Auto Increment

2001-10-23 Thread Mayuresh Kadu
hi all, could anyone tell me how to make a primary key to AUTO INCREMENT. The document is not exactly very explainatory about it :) Thankx in advance ... Mayuresh ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send

Re: [SQL] Diferent databases on same query...

2001-10-23 Thread Douglas Rafael da Silva
Hi, I'd like to do a query where can be possible I access tables from diferent databases on the same query. On MySQL, I do: SELECT People1.PersID, People1.Name, Result1.Value, Result1.Date FROM Database1.People1, Database2.Result1 WHERE ... I think on ORACLE works like as: SELECT

Re: [SQL] Granting database level permissions...

2001-10-23 Thread Steve Brett
have a look at pg_hba.conf in your data dir. it's all in there. Steve Thomas Swan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is it possible to grant database level access to a user in PostgreSQL? I have created a user and database, and I want the user to

Re: [SQL] Auto Increment

2001-10-23 Thread Arian Prins
On Mon, 22 Oct 2001 12:06:21 +0530, Mayuresh Kadu [EMAIL PROTECTED] wrote: hi all, could anyone tell me how to make a primary key to AUTO INCREMENT. The document is not exactly very explainatory about it :) Thankx in advance ... Mayuresh Try first creating a sequence and then using the

Re: [SQL] Index of a table is not used (in any case)

2001-10-23 Thread Marc Spitzer
In article [EMAIL PROTECTED], Josh Berkus wrote: Reinier, For future notice, [SQL] is the correct list for this kind of inquiry. Please do not post it to [HACKERS]. And please don't cross-post ... it results in a lot of needless duplication of effort. I have defined a table and the

[SQL] can't update 'c:\windows'

2001-10-23 Thread guard
dear all IF update table set field='c:\windows' but c:\windows - c:windows -- ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

Re: [SQL] PL/pgSQL triggers ON INSERT OR UPDATE

2001-10-23 Thread Aasmund Midttun Godal
First, I may be wrong but I do think they would prefer if you did not cross-post (especially to hackers). Second I think it probably make more sense to make two different triggers here. If you really wanted to do it that way you might want to try executing that part. Regards, Aasmund. On

Re: [SQL] Index of a table is not used (in any case)

2001-10-23 Thread Doug McNaught
Reiner Dassing [EMAIL PROTECTED] writes: I would like to mention first, that I will use the [SQL] list for my answers, regarding the notice of Josh Berkus. Q: did you use VACUUM ANALYZE? A: This table was a test bed, just using INSERTS without ANY deletes or updates You still need to

Re: [SQL] Index of a table is not used (in any case)

2001-10-23 Thread mlw
Doug McNaught wrote: Reiner Dassing [EMAIL PROTECTED] writes: Hello PostgreSQl Users! PostSQL V 7.1.1: I have defined a table and the necessary indices. But the index is not used in every SELECT. (Therefore, the selects are *very* slow, due to seq scan on 20 million entries,

Re: [SQL] oid's in views.

2001-10-23 Thread Dado Feigenblatt
Josh Berkus wrote: Aasmund, Thank you for the clarification. Now that I know what you are doing, I went through exactly the same thing about a year ago ... which is how we discovered some additional problems with using OIDs in database design. I was trying to spare you the same dead