Re: [SQL] PostgreSQL ignores my indexes

2005-02-24 Thread Bruce Momjian
Andrew Sullivan wrote: > This is probably better on -performance, and is certainly a FAQ. > But. . . > > On Wed, Feb 23, 2005 at 03:01:52PM +0100, Thomas Braad Toft wrote: > > > > Table device contains 5285 rows, tmeevent contains 834912 rows. >

[SQL] diference in dates in minutes

2005-02-24 Thread Joel Fradkin
Sorry for being redundant (I asked this a while back). I was looking for in days before and used date math Date1::date - date2::date returned the days which was fine for my original question. I did get a reply mentioning the age function and he mentioned I could get minutes etc. I looked up age in

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Tom Lane
Richard Huxton writes: > Steve - DND wrote: >> This doesn't seem to be quite what I'm looking for. > Well, if psql vars, prepare or functions don't meet your needs, I'm not > sure we've got anything that will. ecpg is another possible answer. > Have you got a specific example where these don't

Re: [SQL] How do you compare contents of two tables using 2 pk

2005-02-24 Thread Joel Fradkin
Couldn’t you do a select * from t1 where not in uniquevar (select uniquevar from t2)? Or do a join and select on a value in t2 being null. Joel Fradkin   ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://a

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Richard Huxton
Steve - DND wrote: Michael's given you one option - another to look at is PREPARE/EXECUTE PREPARE my_query(int4) AS INSERT INTO foo VALUES ($1); EXECUTE my_query(1); EXECUTE my_query(7); ... This doesn't seem to be quite what I'm looking for. PREPARE according to the docs is for a one line stateme

[SQL] How do you compare contents of two tables using 2 pk

2005-02-24 Thread Kent Anderson
I have two tables that should contain the same number or records. Both tables use the same 2 foreign keys as their primary keys.   I did a count on the number of records in both and found one table has 500 records less than the first table so I need to know which records are not in the secon

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Bricklen Anderson
Steve - DND wrote: I don't know about pgAdmin, but in psql you can use \set: \set id 1 SELECT * FROM foo WHERE id = :id; \set name '\'Some Name\'' SELECT * FROM foo WHERE name = :name; Whenever I try the above I get an error at the backslash. Do I need to create a different language for this? Righ

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Steve - DND
> > I don't know about pgAdmin, but in psql you can use \set: > > \set id 1 > SELECT * FROM foo WHERE id = :id; > > \set name '\'Some Name\'' > SELECT * FROM foo WHERE name = :name; > Whenever I try the above I get an error at the backslash. Do I need to create a different language for this? Right

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Michael Fuhr
On Thu, Feb 24, 2005 at 10:04:50AM -0700, Steve - DND wrote: > > \set name '\'Some Name\'' > > SELECT * FROM foo WHERE name = :name; > > Whenever I try the above I get an error at the backslash. Do I need to > create a different language for this? Right now I only have plpgsql > available. Did y

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Steve - DND
> Michael's given you one option - another to look at is PREPARE/EXECUTE > PREPARE my_query(int4) AS INSERT INTO foo VALUES ($1); > EXECUTE my_query(1); > EXECUTE my_query(7); > ... This doesn't seem to be quite what I'm looking for. PREPARE according to the docs is for a one line statement. I'm l

[SQL] Unsuscribe

2005-02-24 Thread Alexis Vasquez
Unsuscribe __ Renovamos el Correo Yahoo!: ¡250 MB GRATIS! Nuevos servicios, más seguridad http://correo.yahoo.es ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go t

Re: [SQL] Speeds using a transaction vrs not

2005-02-24 Thread Richard Huxton
Joel Fradkin wrote: Thanks. I guess I could add that logic, but this is a one time process going to run the night we go live on postgres. With .net it took like 2 hours to do the whole shebang, so I am happy. Fair enough. I tend to produce a text-file and use COPY for bulk transfers, but that's ju

Re: [SQL] Postgres 8 - Database access, new install.

2005-02-24 Thread Joel Fradkin
I had a good install, but I did not install 7.4 when I installed redhat. It asked for the cd’s a couple times when I loaded the RPMS 8.0.1 I also did not use any fire wall or security (it is in a secure environment).   Joel Fradkin       __

Re: [SQL] Speeds using a transaction vrs not

2005-02-24 Thread Joel Fradkin
Thanks. I guess I could add that logic, but this is a one time process going to run the night we go live on postgres. With .net it took like 2 hours to do the whole shebang, so I am happy. But I was curious as we will be using odbc for our asp (aprx 90% of our app). I could test wrapping the .ne

Re: [SQL] Advanced SELECT

2005-02-24 Thread Tom Lane
Richard Huxton writes: > Search the mailing-list archives for "custom aggregate concat" and > you'll quickly find an example of how to write your own custom aggregate > (like SUM()). > Warning - I don't think you can guarantee the order of elements in the > aggregated sectors. In recent PG ve

[SQL] Read count ?

2005-02-24 Thread Aarni Ruuhimäki
Hi, Could someone please give a hint on how to query the following neatly ? Get news from a news table that belong to a particular account, get segment name from segments table for each news item and read count from read history table that gets a news_id and timestamp insert every time the news

[SQL] Postgres 8 - Database access, new install.

2005-02-24 Thread Mark Roberts
Hi all, Ive just installed the latest version of Postgres 8 on a RedHat 9 server. The problem im having is than when I try to login to the database i.e. 'psql -U postgres template1' im getting the following message:   psql: relocation error: psql: undefined symbol: PQsetErrorVerbosity   Upon rea

Re: [SQL] Software for database-visualisation

2005-02-24 Thread T E Schmitz
Kai Hessing wrote: Another question: Which software are you using to visualize your database-structur. We're doing it with Quark, but are not very happy with this. DbVisualizer (free version) http://www.minq.se/products/dbvis/index.html -- Regards/Gruß, Tarlika Elisabeth Schmitz ---

Re: [SQL] Speeds using a transaction vrs not

2005-02-24 Thread Richard Huxton
Joel Fradkin wrote: No I did not do it in on transaction (although in .net I never started or commited a transaction. All inserts/updates/etc take place within a transaction with PostgreSQL. Some client libraries autocommit for you - you'll need to read the documentation. ODBC : myCommand.Comman

[SQL] Postgresql inheritance workaround

2005-02-24 Thread Philippe Lang
Hi, Because of the actual limitations of Postgresql inheritance mecanism regarding constraints, I'm not willing to use it in my project, although it's exactly the kind of idea I need: In an order and manufacturing management system, several different items can be ordered, each of them with specif

Re: [SQL] Speeds using a transaction vrs not

2005-02-24 Thread Joel Fradkin
No I did not do it in on transaction (although in .net I never started or commited a transaction. ODBC : myTrans = myConnection.BeginTransaction(IsolationLevel.ReadCommitted) ' Assign transaction object for a pending local transaction myCommand.Transaction = myTrans 'example of insert 'myCommand

Re: [SQL] Software for database-visualisation

2005-02-24 Thread Sean Davis
If you mean literally visualizing the ERD, you can look at SQL::Translator (on cpan) which can draw fairly complex ERDs and output as graphics (I forget the supported formats) Sean On Feb 24, 2005, at 3:17 AM, Richard Huxton wrote: Kai Hessing wrote: Another question: Which software are you

Re: [SQL] aggregate / group by question

2005-02-24 Thread T E Schmitz
Hello Keith, Thank you for your help. Keith Worthington wrote: T E Schmitz wrote: Tables: TRANSAKTION --- KIND ('R' or 'S' for refund or sale) TRANSAKTION_PK PAYMENT_METHOD (cheque, cash, CC) ITEM TRANSAKTION_FK ITEM_PK RETAIL_PRICE DISCOUNT Desired result set: PAYMENT_METHOD | categor

Re: [SQL] Junk queries with variables?

2005-02-24 Thread KÖPFERL Robert
In pgadmins SQL-window SQL is the 'language' of choice. Or it is rather the only language. Thus if you intend to program plTk or PL/pgSQL, there's no way around defining a function. (At first you have to define a new language in your schema) C:\> -Original Message- C:\> From: Steve - DND

Re: [SQL] Advanced SELECT

2005-02-24 Thread Richard Huxton
Kai Hessing wrote: The normal clause would look like: SELECT c.companyname, s.sectorname FROM company c, sector s, company_sector cs WHERE cs.cid = c.cid AND cs.sid = s.sid ORDER BY c.companyname; c.companyname | ??? (sectors) ---+ company1 | secto

Re: [SQL] Junk queries with variables?

2005-02-24 Thread Richard Huxton
Steve - DND wrote: I really have to be missing something here and this probably a *really* noob question. I don't have a problem running little junk queries in the pgAdmin query window(SELECT blah FROM blah, INSERT INTO blah, etc...), but I can't figure out how to run queries with variables outside

Re: [SQL] Software for database-visualisation

2005-02-24 Thread Richard Huxton
Kai Hessing wrote: Another question: Which software are you using to visualize your database-structur. We're doing it with Quark, but are not very happy with this. Well, AutoDoc can generate HTML/Dia/other outputs http://www.rbt.ca/autodoc/index.html Might be worth checking the (freely available)

Re: [SQL] Postgres 8 - problem: invalid input syntax for integer

2005-02-24 Thread Richard Huxton
mauro wrote: Hi, In previous version di Postgres (7.2) I used this table: CREATE TABLE tablename (id serial, field int1, field2 text); Now this query work: UPDATE tablename SET field1=''; (NOTE: implicit conversion to 0) UPDATE tablename SET field2=''; (this cause of simple code-generation query -

Re: [SQL] Postgres performance

2005-02-24 Thread Richard Huxton
mauro wrote: Hi, I understand this is an super-older thread!! note: i like postgres and not mysql! Hi Mauro! Whether you like it or hate it, you're in the right place to ask questions about it. I'm a Postgres server user: I've postgres 7.2 and 8.0 in many servers and I've tested performance Postgr