[SQL] crosstab

2005-03-01 Thread Theo Galanakis
Title: crosstab Hi I have looked into the tablefunc / crosstab contrib for postgres and it appears like it can't perform what I need. The crosstab function converts this :     row_name    cat    value     --+---+---   row1  cat1    val1

Re: [SQL] crosstab

2005-03-01 Thread Josh Berkus
THeo, > I have tried using unions or subselects however the table is quite large > and it takes far too long to run. The most efficient way would be to create > a stored proc that uses a cursor to loop through the table transforming the > data into the new table structure. However I would apprecia

[SQL] Performance of Views

2005-03-01 Thread Steffen Boehme
Hello there, i have a short question ... I have a few tables (at the moment "only" 3 for testing), over which will by made a query in this form: SELECT a.orderitem_id, a.transaction_id, a.order_id, a.shop_id, a.quantity, a.price, b.affiliat

Re: [SQL] Advanced SELECT

2005-03-01 Thread Kai Hessing
Hi, Tom Lane schrieb: > [ experiments... ] This works reliably in 7.4 and up. Before that, > the optimizer didn't make the connection between the sort ordering of > the inner query and that needed by the outer, so it would repeat the > sort step using only key1 and very possibly destroy the key2

[SQL] Postgresql FK to MS SQL triggers

2005-03-01 Thread Igor Kryltsov
Hi, If you are moving from Postgres to MS SQL you will most likely will find that you can not recreate your PostgreSQL FK to MSSQL FK because this enterprise class database will NOT allow you to create all 3 FK which are exist in your PGSQL: table users(user_id PK) table journal(created_by, mod

[SQL] psql encoding problem

2005-03-01 Thread T E Schmitz
Hello, I am trying to insert the following record: INSERT INTO item (name,retail_price) VALUES ('Cheese Soufflé',7.95,); (I presume you see the accented character in *Soufflé*) psql comes back with "invalid byte sequence for encoding "UNICODE": 0xe9" If I do this via DbVisualizer, the record is in

Re: [SQL] Postgres performance

2005-03-01 Thread mauro
> Not always, AFAICT. The four most common reasons why PG tests slower > than Mysql are: > 1. You haven't configured or have misconfigured PostgreSQL. > 2. You are testing a MySQL-tuned application (lots of small, simple > queries, no views, no subselects etc) > 3. You are only testing one connec

Re: [SQL] table constraints

2005-03-01 Thread Greg Patnude
foreign keys and primary keys have to be defined as unique at the table / column level if you want to implement a check constraint -- your contrived example doesn't stand up all that well -- If you want to use constraints -- then your database schema should conform to traditional RDBMS theory a