Re: [GENERAL] MSSQL to PostgreSQL : Encoding problem

2006-11-24 Thread Arnaud Lesauvage
Tomi NA a écrit : 2006/11/23, Arnaud Lesauvage [EMAIL PROTECTED]: Arnaud Lesauvage a écrit : Brandon Aiken a écrit : It also might be a big/little endian problem, although I always thought that was platform specific, not locale specific. Try the UCS-2-INTERNAL and UCS-4-INTERNAL codepages

Re: [GENERAL] COPY FROM : out of memory

2006-11-24 Thread Arnaud Lesauvage
Alvaro Herrera a écrit : Arnaud Lesauvage wrote: Martijn van Oosterhout a écrit : On Thu, Nov 23, 2006 at 11:27:06AM -0500, Tom Lane wrote: Arnaud Lesauvage [EMAIL PROTECTED] writes: When trying to import a 20M rows csv file into PostgreSQL, I get : ERROR: out of memory État SQL :53200

[GENERAL] IN clause

2006-11-24 Thread surabhi.ahuja
Hi, i have a table and i have the query select * from table where col_name is null; it returns some rows now, say i have to implement the same query using the in clause how shold it be done? select * from table where col_name in (null); but it does not return any rows. Can you please

[GENERAL] more than one row returned by a subquery used as an expression

2006-11-24 Thread Andrus
select * from information_schema.key_column_usage returns ERROR: more than one row returned by a subquery used as an expression SQL state: 21000 How to reconstruct primay and foreign key statements ? Andrus. PostgreSQL 8.1.1 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2

[GENERAL] How to clone a table so that primay and foreign keys remain

2006-11-24 Thread Andrus
I need to clone a schema in a database programmatically. Using pg_dump.exe to dump chema in plain text, then rename old schema and after that use pg_restore.exe to restore schema is slow since I need to clone data only in some smaller tables. Most of tables should be cloned without data. To

Re: [GENERAL] How to make a copy of schema

2006-11-24 Thread Andrus
In need to add some routine to my application which can create schema copy ? You can make a pg_dump with option -n Company5, replace in the dump Company5 with Company6 and restore this. I dont have suffix like _schema in my company schema names. So Company5 string may be used in places

Re: [GENERAL] Postgres scalability and performance on windows

2006-11-24 Thread Mark Cave-Ayland
Hi all, I have a postgres installation thats running under 70-80% CPU usage while an MSSQL7 installation did 'roughly' the same thing with 1-2% CPU load. Here's the scenario, 300 queries/second Server: Postgres 8.1.4 on win2k server CPU: Dual Xeon 3.6 Ghz, Memory: 4GB RAM

Re: [GENERAL] IN clause

2006-11-24 Thread A. Kretschmer
am Fri, dem 24.11.2006, um 14:42:30 +0530 mailte surabhi.ahuja folgendes: Hi, i have a table and i have the query select * from table where col_name is null; it returns some rows now, say i have to implement the same query using the in clause how shold it be done? select *

Re: [GENERAL] Stuck in DELETE waiting

2006-11-24 Thread Alexander Staubo
On Nov 24, 2006, at 01:37 , Jerry Sievers wrote: Have a look at the query_start field in pg_stat_activity for the process holding locks that's causing backlog. Doesn't this require stats_command_string = on? I don't have that enabled on production servers. Alexander.

[GENERAL] vacuum: out of memory error

2006-11-24 Thread Jakub Ouhrabka
Hi all, I have few of these messages in server log: ERROR: out of memory DETAIL: Failed on request of size 262143996. STATEMENT: VACUUM ANALYZE tablename There are few of them, always the same request size(?) but different two databases (out of 100+) and few different tables (pg_listener,

Re: [GENERAL] IN clause

2006-11-24 Thread surabhi.ahuja
That is fine but what I was actually expecting is this if select * from table where col_name in (null, 'a', 'b'); to return those rows where col_name is null or if it = a or if it is = b But i think in does not not support null queries , am i right? From:

Re: [GENERAL] Postgres scalability and performance on windows

2006-11-24 Thread Gopal
Hi, Thanks for your suggestions. Here's an output of the explain analyse. I'll change the shared_buffers and look at the behaviour again. Limit (cost=59.53..59.53 rows=1 width=28) (actual time=15.681..15.681 rows=1 loops=1) - Sort (cost=59.53..59.53 rows=1 width=28) (actual

Re: [GENERAL] IN clause

2006-11-24 Thread Martijn van Oosterhout
On Fri, Nov 24, 2006 at 05:31:07PM +0530, surabhi.ahuja wrote: That is fine but what I was actually expecting is this if select * from table where col_name in (null, 'a', 'b'); to return those rows where col_name is null or if it = a or if it is = b But i think in does not not support

Re: [GENERAL] IN clause

2006-11-24 Thread Alban Hertroys
surabhi.ahuja wrote: That is fine but what I was actually expecting is this if select * from table where col_name in (null, 'a', 'b'); to return those rows where col_name is null or if it = a or if it is = b But i think in does not not support null queries , am i right? Expressions

Re: [GENERAL] tsearch to spellcheck

2006-11-24 Thread Teodor Sigaev
You can use lexize() function from tsearch2 (with properly configured ispell dictionary) - if it returns not NULL value the word is ok. Also have a look to pg_trgm contrib modle. SunWuKung wrote: Is it possible to use tsearch2 to check spelling? Something like a function that takes a single

Re: [GENERAL] How to clone a table so that primay and foreign keys remain

2006-11-24 Thread William Leite Araújo
http://www.alberton.info/postgresql_meta_info.html 2006/11/24, Andrus [EMAIL PROTECTED]: I need to clone a schema in a database programmatically. Using pg_dump.exe to dump chema in plain text, then rename old schema and after that use pg_restore.exe to restore schema is slow since I need to

Re: [GENERAL] IN clause

2006-11-24 Thread Brandon Aiken
Hasn't it been said enough? Don't allow NULLs in your database. Databases are for storing data, not a lack of it. The only time NULL should appear is during outer joins. -- Brandon Aiken CS/IT Systems Engineer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

Re: [GENERAL] IN clause

2006-11-24 Thread Marcus Engene
I see we have a C J Date fan on the list! ;-) There is one other case where I personally find nullable columns a good thing: process_me ish flags. When a row is not supposed to be processed that field is null and when a field is null it wont be in the index [at least on Oracle]. Best regards,

[GENERAL] indexes

2006-11-24 Thread Tom Allison
I notice a lot of places where people use the approach of creating an index and a unique key like: CREATE TABLE foo ( idx SERIAL PRIMARY KEY, name varchar(32) UNIQUE NOT NULL ) instead of CREATE TABLE foo ( name varchar(32) PRIMARY KEY ) If the name is NEVER going to change, is there

Re: [GENERAL] indexes

2006-11-24 Thread Brandon Aiken
I asked this question here awhile ago. It's a fairly common question, and it's known as the surrogate vs natural key debate. Using a natural key has the advantage of performance. With a surrogate key, most RDBMS systems will have to maintain two indexes. Natural keys can also make your

Re: [GENERAL] indexes

2006-11-24 Thread Joshua D. Drake
On Fri, 2006-11-24 at 09:54 -0500, Tom Allison wrote: I notice a lot of places where people use the approach of creating an index and a unique key like: CREATE TABLE foo ( idx SERIAL PRIMARY KEY, name varchar(32) UNIQUE NOT NULL ) instead of CREATE TABLE foo ( name

Re: [GENERAL] IN clause

2006-11-24 Thread Richard Broersma Jr
That is fine but what I was actually expecting is this if select * from table where col_name in (null, 'a', 'b'); to return those rows where col_name is null or if it = a or if it is = b But i think in does not not support null queries , am i right? that is correct: if col_name was

Re: [GENERAL] indexes

2006-11-24 Thread Ben
It depends how it's going to be used. If you are going to reference this table in other tables a lot and/or rarely care about what the name actually is, then the two-column approach is going to be more efficient. Numbers are smaller and easier to compare than strings. On Nov 24, 2006, at

Re: [GENERAL] IN clause

2006-11-24 Thread Ragnar
On fös, 2006-11-24 at 10:10 -0800, Richard Broersma Jr wrote: That is fine but what I was actually expecting is this if select * from table where col_name in (null, 'a', 'b'); to return those rows where col_name is null or if it = a or if it is = b But i think in does not not

Re: [GENERAL] Extract between year *and* month

2006-11-24 Thread Syl
Russell Smith wrote: One wrote: Hi - I'd like to return search results based on a date range that is selected by the user : select name=date1yy option value=1995-01-01 selected1995/option select name=date2yy option value=2006-12-31 selected2006/option My SQL is

[GENERAL] PGDATA

2006-11-24 Thread sasan3
I just can't understand the use of this PGDATA variable! -I am on FC3. (pgl 7.4) -I am installing rpms and then running /etc/init.d/postgresql start (which is done by default) -The resulting data directory is in /var/lib/pgsql/data I now want the data directory to be on

[GENERAL] Dollaw sign quoting disabled

2006-11-24 Thread snappingturtle
It appears that in my installation of Postgres that dollaw sign quoting is disabled. For example, the following command returns an error: CREATE or replace FUNCTION add_em(int, int) RETURNS integer AS $$ SELECT $1 + $2; $$ LANGUAGE SQL; The error: psql:borman.sql:6: ERROR: syntax

[GENERAL] Connecting via ssh tunnel

2006-11-24 Thread ben short
Hi, I have a postgresql server setup on a Solaris 10 box. I can connect to the db via psql from the local machine. What I have been trying to do it connect with pgAdmin from my workstation. I have setup the tunnel correctly, local port 5432 and destination localhost:5432. Everytime I try to

[GENERAL] Carriage-Return in text field

2006-11-24 Thread sasan3
How do I insert text into a TEXT field that has a carriage-return in it? I can obviously replace all CR with \n but isn't there an easier way to do it? Thanks. ---(end of broadcast)--- TIP 4: Have you searched our list archives?

[GENERAL] How to restore a dumbed file in postgreSQL

2006-11-24 Thread Yesh
Hi, I am a newbie to postgreSQL. I need to know the command for restoring a database that has been dumped. I am using postgreSQL8.1 version am running in windows environment. -- View this message in context:

Re: [GENERAL] IN clause

2006-11-24 Thread Richard Broersma Jr
yes, except I think you meant: (unknown or false or false) = unknown as can be demonstrated by: test=# \pset null 'null' Null display is null. test=# select (null or true); ?column? -- t (1 row) test=# select (null or false); ?column? -- null (1 row)

Re: [GENERAL] PGDATA

2006-11-24 Thread Richard Broersma Jr
I just can't understand the use of this PGDATA variable! -I am on FC3. (pgl 7.4) -I am installing rpms and then running /etc/init.d/postgresql start (which is done by default) -The resulting data directory is in /var/lib/pgsql/data I now want the data directory to be on

Re: [GENERAL] Connecting via ssh tunnel

2006-11-24 Thread Leonel Nunez
Hi, I have a postgresql server setup on a Solaris 10 box. I can connect to the db via psql from the local machine. What I have been trying to do it connect with pgAdmin from my workstation. I have setup the tunnel correctly, local port 5432 and destination localhost:5432. Everytime I try to

Re: [GENERAL] How to restore a dumbed file in postgreSQL

2006-11-24 Thread Richard Broersma Jr
I am a newbie to postgreSQL. I need to know the command for restoring a database that has been dumped. I am using postgreSQL8.1 version am running in windows environment. See. http://www.postgresql.org/docs/8.2/interactive/backup-dump.html#BACKUP-DUMP-RESTORE Also, you will find a wealth

Re: [GENERAL] indexes

2006-11-24 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 But that requires that you haul an artificial construct around. On 11/24/06 12:38, Ben wrote: It depends how it's going to be used. If you are going to reference this table in other tables a lot and/or rarely care about what the name actually is,

Re: [GENERAL] Dollaw sign quoting disabled

2006-11-24 Thread Bricklen Anderson
snappingturtle wrote: It appears that in my installation of Postgres that dollaw sign quoting is disabled. For example, the following command returns an error: snip I didn't do anything (that I know of) to disable dollar quoting. Any advice on how to enable dollar sign quoting? Are you

Re: [GENERAL] How to restore a dumbed file in postgreSQL

2006-11-24 Thread Raymond O'Donnell
On 23 Nov 2006 at 20:13, Yesh wrote: I am a newbie to postgreSQL. I need to know the command for restoring a database that has been dumped. I am using postgreSQL8.1 If you dumped using the text format, simply use the resulting dumpfile as input to psql, something like this - psql -f

Re: [GENERAL] Connecting via ssh tunnel

2006-11-24 Thread Tom Lane
ben short [EMAIL PROTECTED] writes: I have a postgresql server setup on a Solaris 10 box. I can connect to the db via psql from the local machine. What I have been trying to do it connect with pgAdmin from my workstation. I have setup the tunnel correctly, local port 5432 and destination

Re: [GENERAL] Carriage-Return in text field

2006-11-24 Thread Kevin Field
I've run into this issue a bit... Do you mean, it's in the DB okay, but when it comes back to the client it breaks your transport mechanism (say, if you use JSON)? So far I've just been using a replace...if you find another way I'd love to hear it. (Because I also have to escape quotes and

Re: [GENERAL] Connecting via ssh tunnel

2006-11-24 Thread Uwe C. Schroeder
On Friday 24 November 2006 12:56, ben short wrote: Hi, I have a postgresql server setup on a Solaris 10 box. I can connect to the db via psql from the local machine. What I have been trying to do it connect with pgAdmin from my workstation. I have setup the tunnel correctly, local port 5432

Re: [GENERAL] more than one row returned by a subquery used as an expression

2006-11-24 Thread Tom Lane
Andrus [EMAIL PROTECTED] writes: select * from information_schema.key_column_usage returns ERROR: more than one row returned by a subquery used as an expression There's a known bug of that ilk in 8.2beta, but I don't see how it could happen in 8.1 ... you sure you're seeing this on 8.1.1?

Re: [GENERAL] indexes

2006-11-24 Thread Ben
Yes, it does. So of course it depends on how you use it to know what's going to be more efficient. For instance, if the rows in this table contain strings of more than a few bytes, and more than a couple tables reference this table with a foreign key, then you will quickly start to save

Re: [GENERAL] Connecting via ssh tunnel

2006-11-24 Thread Ray Stell
On Fri, Nov 24, 2006 at 04:42:56PM -0500, Tom Lane wrote: Surely that is not a correct tunnel setup ... you can't have both ends being the same port number on the same machine. There Can Be Only One process listening on a given port per machine. I think he is refering the -L option of ssh

Re: [GENERAL] indexes

2006-11-24 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 True. That doesn't mean I like it... Real-life example: We design and run customer service centers for many toll roads in the US Northeast. So, we have a set of tables like this: T_AGENCY ( AGENCY_IDINTEGER PRIMARY KEY, AGENCY_CODE CHAR(2),