Re: [GENERAL] Refer to another database

2009-08-03 Thread John R Pierce
Andreas Kalsch wrote: Two causes: 1) I have to rewrite many lines of code = time 2) In MySQL I have access - with superuser rights - to _all_ existing databases inside the installation. In Postgres I haven't. hmm? the postgresql superuser has full access to all databases in the cluster.

Re: [GENERAL] Refer to another database

2009-08-03 Thread John R Pierce
Andreas Kalsch wrote: This is what I want to do: To refer to another database, like I can do it in MySQL. After adding a schema with database name and refering to it from another database I get: ERROR: schema "test" does not exist Adding the database name: osm_de=# select * from test.test.n

Re: [GENERAL] Refer to another database

2009-08-03 Thread Andreas Kalsch
Two causes: 1) I have to rewrite many lines of code = time 2) In MySQL I have access - with superuser rights - to _all_ existing databases inside the installation. In Postgres I haven't. But, of course, that are just details. Best, Andi Tom Lane schrieb: Andreas Kalsch writes: This is

Re: [GENERAL] Refer to another database

2009-08-03 Thread Tom Lane
Andreas Kalsch writes: > This is what I want to do: To refer to another database, like I can do > it in MySQL. You're too hung up on the word "database". MySQL "databases" are very nearly equivalent to Postgres schemas. Use multiple schemas within one Postgres database and be happy. > - I hav

Re: [GENERAL] Refer to another database

2009-08-03 Thread Andreas Kalsch
This is what I want to do: To refer to another database, like I can do it in MySQL. After adding a schema with database name and refering to it from another database I get: ERROR: schema "test" does not exist Adding the database name: osm_de=# select * from test.test.newt; ERROR: cross-data

Re: [GENERAL] Refer to another database

2009-08-03 Thread John R Pierce
Andreas Kalsch wrote: Will it decrease performance to refer to other schemas? no. the schemas are simply two namespaces in the same database. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsq

Re: [GENERAL] Refer to another database

2009-08-03 Thread Tom Lane
Andreas Kalsch writes: > Will it decrease performance to refer to other schemas? No, not to any noticeable extent. I'm not actually sure whether parsing would be faster for an explicitly qualified reference or an unqualified one, but in any case it'd be down in the noise compared to planning and

Re: [GENERAL] Refer to another database

2009-08-03 Thread Andreas Kalsch
Will it decrease performance to refer to other schemas? David Fetter schrieb: On Tue, Aug 04, 2009 at 04:41:51AM +0200, Andreas Kalsch wrote: How is it possible to refer to another database, like: select * from otherDatabase.nodes; Generally, you use schemas for this. Schemas are j

Re: [GENERAL] Refer to another database

2009-08-03 Thread David Fetter
On Tue, Aug 04, 2009 at 04:41:51AM +0200, Andreas Kalsch wrote: > How is it possible to refer to another database, like: > > select * from otherDatabase.nodes; Generally, you use schemas for this. Schemas are just namespaces inside the one database. > I have read something about schemas and I ha

[GENERAL] Refer to another database

2009-08-03 Thread Andreas Kalsch
How is it possible to refer to another database, like: select * from otherDatabase.nodes; I have read something about schemas and I have simply created an own schema for every database with the same name, but it still does not work. Is there anything plain and simple? Best, Andi -- Sent v

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Alvaro Herrera
Andreas Kalsch wrote: > My question again: Is there a native Postgres solution to simplify > characters consistently? It means to completely remove all > diacriticals from Unicode characters. There's a to_ascii() function but it supports a subset of charsets, and IIRC UTF8 is not one of them. Pa

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Andreas Kalsch
Alban Hertroys schrieb: On 3 Aug 2009, at 20:32, Andreas Kalsch wrote: Problem: Users will enter _any_ characters in my application and an error really doesn't help in this case. I think the real problem is: Where do you lose the original encoding the users input their data with? If you spe

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Alban Hertroys
On 3 Aug 2009, at 20:32, Andreas Kalsch wrote: Problem: Users will enter _any_ characters in my application and an error really doesn't help in this case. I think the real problem is: Where do you lose the original encoding the users input their data with? If you specify that encoding on t

Re: [GENERAL] Problem with Numerics multiplication in C-function

2009-08-03 Thread Ilya Urikh
Thank's a lot! That's really help. I failed to bear memory context switching in mind. I resolved this problem with following strings in *getRate*: result = SPI_palloc(sizeof(rate)); memcpy(result, rate, sizeof(rate)); P.S. I think it's a good idea to add example to documentation. Anyway when

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Andreas Kalsch
So there is definitely no way to this natively? Which would be better because this an easy task, which should be part of the main distribution. What is more performant - has anyone made a benchmark? 1) Perl: http://markmail.org/message/2jpp7p26ohreqnsh?q=plperlu+iconv+postgresql&page=1&refer=2

[GENERAL] iGen with PostgreSQL 8.4 on Sun Fire X4140

2009-08-03 Thread Reid Thompson
may be of interest -- http://blogs.sun.com/jkshah/entry/igen_with_postgresql_8_4 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] how can i mark date function like iscachable

2009-08-03 Thread Tom Lane
erobles writes: >> i tried to create an functional index like this: >> create index estdistfecha on estadist (date(fecha)); >> but only get the next message: >> ERROR: DefineIndex: index function must be marked iscachable. Egad, what are you running? That message hasn't been spelled that way

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Alvaro Herrera
Andreas Kalsch wrote: > The function "convert_to(string text, dest_encoding name)" will > throw an error and so break my application when not supported > characters are included in the unicode string. > So what can I do > - to filter characters out which have no counterpart in the latin codesets >

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Pavel Stehule
2009/8/3 Andreas Kalsch : > The function "convert_to(string text, dest_encoding name)" will throw an > error and so break my application when not supported characters are included > in the unicode string. > So what can I do > - to filter characters out which have no counterpart in the latin codeset

Re: [GENERAL] how can i mark date function like iscachable

2009-08-03 Thread Pavel Stehule
Hello 2009/8/3 erobles : > another thing i tried to do was: > > create or replace function lafecha(timestamp with time zone) returns date > as 'select date($1);' > language 'SQL' > with iscachable; > try to use IMMUTABLE Pavel > > But  i got the message: ERROR parser: parse error at or near "is

Re: [GENERAL] how can i mark date function like iscachable

2009-08-03 Thread erobles
another thing i tried to do was: create or replace function lafecha(timestamp with time zone) returns date as 'select date($1);' language 'SQL' with iscachable; But i got the message: ERROR parser: parse error at or near "iscachable"; if avoid "with iscachable" string the fucntion was cre

[GENERAL] how can i mark date function like iscachable

2009-08-03 Thread erobles
erobles wrote: Hello there! i tried to create an functional index like this: create index estdistfecha on estadist (date(fecha)); but only get the next message: ERROR: DefineIndex: index function must be marked iscachable. So, How can i mark the date function iscachable ? :-) i hope your

Re: [GENERAL] Privilege problems: access denied on select for owner?

2009-08-03 Thread Tom Lane
Nathan Jahnke writes: > So the role "sample" owns the database "sample" and has default > privileges on the table "users" in that database. From the manual: > "There is no need to grant privileges to the owner of an object > (usually the user that created it), as the owner has all privileges by >

Re: [GENERAL] Privilege problems: access denied on select for owner?

2009-08-03 Thread Sam Mason
On Mon, Aug 03, 2009 at 01:39:08PM -0500, Nathan Jahnke wrote: > So the role "sample" owns the database "sample" and has default > privileges on the table "users" in that database. From the manual: > > "There is no need to grant privileges to the owner of an object > (usually the user that created

Re: [GENERAL] \copy command error

2009-08-03 Thread Sam Mason
On Mon, Aug 03, 2009 at 01:18:06PM -0500, erobles wrote: > Maybe the error is \c because '\c' is used to connect to another > database. > try the same line without '\' only : > copy gisp from d:/projects/gisp/gisp.csv' delimiters ','; \copy is a special command in psql that does a cop

[GENERAL] Privilege problems: access denied on select for owner?

2009-08-03 Thread Nathan Jahnke
Hi all, Having some trouble today accessing tables in a database: sample=# \l+ List of databases Name| Owner | Encoding | Tablespace |Description ---+--+--++--- postgres | postgres | UTF8

[GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-03 Thread Andreas Kalsch
The function "convert_to(string text, dest_encoding name)" will throw an error and so break my application when not supported characters are included in the unicode string. So what can I do - to filter characters out which have no counterpart in the latin codesets - or to simple ignore wrong cha

Re: [GENERAL] \copy command error

2009-08-03 Thread Sam Mason
On Mon, Aug 03, 2009 at 01:25:56PM -0400, Mark Watson wrote: > Andrew Maracini wrote: > >GISCI# \copy gisp from 'd:/projects/gisp/gisp.csv' delimiter ',' > > If this is the case, exporting the > City/state field wrapped in quotation marks should do the trick You'll want to use the real CSV parser

Re: [GENERAL] \copy command error

2009-08-03 Thread erobles
Mark Watson wrote: *>De :* pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] *De la part de* Andrew Maracini >*Envoyé :* 3 août 2009 11:46 >*À :* pgsql-general@postgresql.org >*Objet :* [GENERAL] \copy command error > >hi, > >I can't seem to get the \copy comm

Re: [GENERAL] \copy command error

2009-08-03 Thread Mark Watson
>De : pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] De la part de Andrew Maracini >Envoyé : 3 août 2009 11:46 >À : pgsql-general@postgresql.org >Objet : [GENERAL] \copy command error > >hi, > >I can't seem to get the \copy command to work. > >Here's my syntax: >

Re: [GENERAL] using generate_series to iterate through months

2009-08-03 Thread Sam Mason
On Mon, Aug 03, 2009 at 11:15:25AM -0400, Bill Reynolds wrote: > Here is what I am using in the from clause (along with other tables) to > generate the series of numbers for the number of months. This seems to > work: > generate_series( 0, ((extract(years from age(current_date, > DATE('2008-05-01'

[GENERAL] \copy command error

2009-08-03 Thread Andrew Maracini
hi, I can't seem to get the \copy command to work. Here's my syntax: GISCI# \copy gisp from 'd:/projects/gisp/gisp.csv' delimiter ',' ERROR extra data after last expected column Line 1 It is taking all of the fields and grouping them into one field, the .csv has about 4700 records, here is wh

Re: [GENERAL] using generate_series to iterate through months

2009-08-03 Thread Bill Reynolds
Ok, it is Monday -:) Thanks Tom! -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: Monday, August 03, 2009 11:44 AM To: Bill Reynolds Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] using generate_series to iterate through months "Bill Reynolds" writes: > Ok

Re: [GENERAL] using generate_series to iterate through months

2009-08-03 Thread Andreas Kretschmer
Bill Reynolds wrote: > Ok, I'm a bit stumped on getting my group by query to work which > iterates through a number of months that basically a generate_series > provides for me. > > Here is what I am using in the from clause (along with other tables) to > generate the series of numbers for the n

Re: [GENERAL] Partition tables

2009-08-03 Thread Wojtek
Michael Gould wrote: 2. can you come up with a pattern you can use to segment your data into smaller chunks (like weeks, months, ids) to create partitions reasonably big but not huge Yes, each location has their own specific location code. good! how many rows you will have per each l

Re: [GENERAL] using generate_series to iterate through months

2009-08-03 Thread Tom Lane
"Bill Reynolds" writes: > Ok, I'm a bit stumped on getting my group by query to work which > iterates through a number of months that basically a generate_series > provides for me. > ... > select DATE('2008-05-01') + interval (s.a??? ' months') as Month_of No, you're confusing a syntax that's mea

Re: [GENERAL] Partition tables

2009-08-03 Thread Wojtek
Michael Gould wrote: I am considering whether or not to partition a few tables in our system. The guide lines I read said that this could help when the size of a table exceeds the amount of system memory. I'm wondering if this statement should be table or database. The way our system operates

[GENERAL] using generate_series to iterate through months

2009-08-03 Thread Bill Reynolds
Ok, I'm a bit stumped on getting my group by query to work which iterates through a number of months that basically a generate_series provides for me. Here is what I am using in the from clause (along with other tables) to generate the series of numbers for the number of months. This seems to wor

[GENERAL] Partition tables

2009-08-03 Thread Michael Gould
I am considering whether or not to partition a few tables in our system. The guide lines I read said that this could help when the size of a table exceeds the amount of system memory. I'm wondering if this statement should be table or database. The way our system operates is that each individual

Re: [GENERAL] Problem with Numerics multiplication in C-function

2009-08-03 Thread Tom Lane
Martijn van Oosterhout writes: > On Mon, Aug 03, 2009 at 10:20:36AM -0400, Tom Lane wrote: >> SPI_palloc is what to use to allocate the result in the right place. > Ofcourse, and then a memcpy(). I was distracted by the fact there is an > SPI_copy/returntuple(), but no SPI_returndatum(). Yeah, I

Re: [GENERAL] Problem with Numerics multiplication in C-function

2009-08-03 Thread Martijn van Oosterhout
On Mon, Aug 03, 2009 at 10:20:36AM -0400, Tom Lane wrote: > Martijn van Oosterhout writes: > > What you need to do is copy the Datum you wish to return into the upper > > memory context. I'm not seeing a helpful SPI utility function or > > obvious example here you help you, but I'm sure it's somet

Re: [GENERAL] synchronous_commit=off doesn't always return immediately

2009-08-03 Thread Merlin Moncure
On Mon, Aug 3, 2009 at 2:14 AM, tomrevam wrote: > > > > Tom Lane-2 wrote: >> >> tomrevam writes: >> It might help to increase wal_buffers. >> > > Hi, > > I increased the wal_buffers to 2 MB. Initially this improved the performance > very much, but after 4 days of continuous operation the system is

Re: [GENERAL] Problem with Numerics multiplication in C-function

2009-08-03 Thread Tom Lane
Martijn van Oosterhout writes: > What you need to do is copy the Datum you wish to return into the upper > memory context. I'm not seeing a helpful SPI utility function or > obvious example here you help you, but I'm sure it's something with > MemoryContextSwitchTo() and datumCopy(). SPI_palloc i

[GENERAL] Out of Office AutoReply: Never thought he would be able

2009-08-03 Thread Chris Black
Thank you for your email, Chris Black has left the ACEA - the Victoria/ Tasmania office will be unattended until the 17th November when Chris will be replaced by Cathryn Ellis During this period please contact ACEA NSW on 02 9966 4966 or email. elizab...@acea.com.au or pa...@acea.com.au Kind R

Re: [GENERAL] Problem with Numerics multiplication in C-function

2009-08-03 Thread Martijn van Oosterhout
On Mon, Aug 03, 2009 at 01:45:53PM +1100, Ilya Urikh wrote: > Hi, I have a strange problem with Numeric multiplication in C-function. > > There are 2 functions getRate and getVAT which return Numeric. In 3rd > function calculateService I try to multiply the results of getRate and > getVAT. After e