[GENERAL] How to rename the same column name in dozens of tables in Postgres?

2013-12-17 Thread Stefan Schwarzer
Hi there, I have dozens of tables where I need to rename one column in each of these. Is there any generic way to do that? I am not really familiar with the scripting possibilities of Postgres. Thanks a lot for your help! Stefan -- Sent via pgsql-general mailing list

Re: [GENERAL] How to rename the same column name in dozens of tables in Postgres?

2013-12-17 Thread Stefan Schwarzer
Hi there, I have dozens of tables where I need to rename one column in each of these. Is there any generic way to do that? I am not really familiar with the scripting possibilities of Postgres. Thanks a lot for your help! Stefan You can do with script. I made one on fly for this,

Re: [GENERAL] ERROR: out of shared memory - But the table is empty

2012-07-13 Thread Stefan Schwarzer
not being an expert for Postgres…. I have a Postgis table with the countries of the world. Now, I would like to drop it. I got the error message: ERROR: out of shared memory HINT: You might need to increase max_locks_per_transaction. and thought that it would be easier to

[GENERAL] ERROR: out of shared memory - But the table is empty

2012-07-12 Thread Stefan Schwarzer
Hi there, not being an expert for Postgres…. I have a Postgis table with the countries of the world. Now, I would like to drop it. I got the error message: ERROR: out of shared memory HINT: You might need to increase max_locks_per_transaction. and thought that it would be easier to

Re: [GENERAL] ERROR: function crosstab(unknown, unknown) does not exist

2012-07-09 Thread Stefan Schwarzer
If the textual value of search_path (as per show search_path) lists the schema but current_schemas() doesn't, I have to think that you've got a permissions problem --- the system will silently ignore any search_path entries for which you don't have USAGE permission. You said you'd done a

Re: [GENERAL] ERROR: function crosstab(unknown, unknown) does not exist

2012-07-05 Thread Stefan Schwarzer
Now, when I launch a query which includes crosstab() as a postgres user, everything works fine. However, if I launch it as user XXX, it complaints: Are you schema qualifying the function name when you use it? If not, does user XXX have schema tablefunc in their search_path? Also, does

Re: [GENERAL] ERROR: function crosstab(unknown, unknown) does not exist

2012-07-05 Thread Stefan Schwarzer
Now, when I launch a query which includes crosstab() as a postgres user, everything works fine. However, if I launch it as user XXX, it complaints: Are you schema qualifying the function name when you use it? If not, does user XXX have schema tablefunc in their search_path? Also, does

[GENERAL] ERROR: function crosstab(unknown, unknown) does not exist

2012-07-03 Thread Stefan Schwarzer
Hi there, I am using 9.1.3. I inserted the tablefunc extension, into a SCHEMA called tablefunc, in order to separate it from my tables. I had to create it as postgres user, but changed than the Owner of both schema and functions to my user XXX. Now, when I launch a query which includes

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-25 Thread Stefan Schwarzer
sudo su - _postgres /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US sudo su - _postgres /usr/local/pgsql-9.1/bin/pg_ctl start -D /usr/local/pgsql-9.1/data Although I don't get an error message, I don't have the feeling that it

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-25 Thread Stefan Schwarzer
I just went back to the postgres documentation [1] (actually reading all google results on the error message one after the other) and tried out what was said there (adapted to my conditions): sudo -u _postgres /usr/local/pgsql-9.1/bin/postgres -D /usr/local/pgsql-9.1/data and suddenly

Re: [GENERAL] pg_dump not dumping all tables

2012-06-24 Thread Stefan Schwarzer
Hi there, I am pg_dump-ing all tables from schema public on the server /usr/local/pgsql/bin/pg_dump -U user my_database --schema=public --encoding=UTF-8 dump.sql and re-loading it via psql on my local machine. But instead of having 708 tables as on the server, I end up with

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-22 Thread Stefan Schwarzer
When I do: sudo launchctl load /Library/LaunchDaemons/org.postgresql.postgres.plist it says: org.postgresql.postgres: Already loaded When I do: /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US it says:

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-22 Thread Stefan Schwarzer
sudo su - _postgres /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data --encoding=UTF8 --locale=en_US sudo su - _postgres /usr/local/pgsql-9.1/bin/pg_ctl start -D /usr/local/pgsql-9.1/data Although I don't get an error message, I don't have the feeling that it

Re: [GENERAL] Problem installing extensions on Lion

2012-06-22 Thread Stefan Schwarzer
1) Do the above files actually exist in the above location? Yes, the c.h exist in the mentioned location. However, as it does not indicate where it looks for the stdio.h, perhaps the problem lies there. Indeed. Where did you get the advice to use -isysroot

[GENERAL] pg_dump not dumping all tables

2012-06-22 Thread Stefan Schwarzer
Hi there, I am pg_dump-ing all tables from schema public on the server /usr/local/pgsql/bin/pg_dump -U user my_database --schema=public --encoding=UTF-8 dump.sql and re-loading it via psql on my local machine. But instead of having 708 tables as on the server, I end up with only 570

Re: [GENERAL] How to include Tablefunc as an extension

2012-06-21 Thread Stefan Schwarzer
I read through the Postgres doc and many Google results, but it seems still unclear to me how to include additional packages into my postgres database. I see that there are a few installed under /usr/local/pgsql-9.1/share/extension/ (I am on Lion and installed the Kyngchaos libs). But as I

Re: [GENERAL] How to include Tablefunc as an extension

2012-06-21 Thread Stefan Schwarzer
I do as indicated in Kyngchaos ReadMe file: export PATH=/usr/local/pgsql-9.1/bin:$PATH export USE_PGXS=1 make sudo make install I'm beginning to wonder who are Kyngchaos and whether they are competent at all. They obviously didn't test the above advice. It does not work

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-20 Thread Stefan Schwarzer
I need unfortunately to come back to this issue. I (again) re-installed Lion from scratch, and finally got everything working. The Postgres was running, I uploaded a couple of dumped SQL files. And then re-started the machine for another reason. And suddenly it says again the it can't

Re: [GENERAL] How to include Tablefunc as an extension

2012-06-19 Thread Stefan Schwarzer
I read through the Postgres doc and many Google results, but it seems still unclear to me how to include additional packages into my postgres database. I see that there are a few installed under /usr/local/pgsql-9.1/share/extension/ (I am on Lion and installed the Kyngchaos libs). But as I

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-19 Thread Stefan Schwarzer
I guess this is a typical user error. I searched around to find the solution, but in vain. I just upgraded to Lion, and used Kyngchaos libraries for installation of Postgres. Try to get running postgres, and I get this: /usr/local/pgsql-9.1/bin/psql -U postgres psql: could

[GENERAL] How to include Tablefunc as an extension

2012-06-18 Thread Stefan Schwarzer
Hello, I read through the Postgres doc and many Google results, but it seems still unclear to me how to include additional packages into my postgres database. I see that there are a few installed under /usr/local/pgsql-9.1/share/extension/ (I am on Lion and installed the Kyngchaos libs).

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Stefan Schwarzer
In file included from /usr/local/pgsql-9.1/include/server/postgres.h:47, from tablefunc.c:33: /usr/local/pgsql-9.1/include/server/c.h:67:19: error: stdio.h: No such file or directory /usr/local/pgsql-9.1/include/server/c.h:68:20: error: stdlib.h: No such file or directory

[GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-14 Thread Stefan Schwarzer
Hi there, I guess this is a typical user error. I searched around to find the solution, but in vain. I just upgraded to Lion, and used Kyngchaos libraries for installation of Postgres. Try to get running postgres, and I get this: /usr/local/pgsql-9.1/bin/psql -U postgres psql:

Re: [GENERAL] Problem installing extensions on Lion

2012-06-14 Thread Stefan Schwarzer
On Jun 14, 2012, at 3:32 PM, Adrian Klaver wrote: On 06/14/2012 04:47 AM, Stefan Schwarzer wrote: In file included from /usr/local/pgsql-9.1/include/server/postgres.h:47, from tablefunc.c:33: /usr/local/pgsql-9.1/include/server/c.h:67:19: error: stdio.h: No such file

Re: [GENERAL] Error message psql: could not connect to server: No such file or directory

2012-06-14 Thread Stefan Schwarzer
Hi there, I guess this is a typical user error. I searched around to find the solution, but in vain. I just upgraded to Lion, and used Kyngchaos libraries for installation of Postgres. Try to get running postgres, and I get this: /usr/local/pgsql-9.1/bin/psql -U postgres

[GENERAL] Problem installing extensions on Lion

2012-06-12 Thread Stefan Schwarzer
Hi there, I upgraded my machine from Snow Leopard to Lion, and ran, as usual, into some Postgres update problems. I used Kyngchaos libraries for all frameworks and Postgres. Now, I'd like to install the tablefunc/crosstab function. But the make process gives me this: cd contrib/tablefunc

Re: [GENERAL] Problem installing extensions on Lion

2012-06-12 Thread Stefan Schwarzer
I upgraded my machine from Snow Leopard to Lion, and ran, as usual, into some Postgres update problems. I used Kyngchaos libraries for all frameworks and Postgres. Now, I'd like to install the tablefunc/crosstab function. But the make process gives me this: Looks like your dev env is

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-04 Thread Stefan Schwarzer
What version of PostgreSQL are you running? The error seems to indicate that you don't have the crosstab(text,text) form of the function. In psql do: contrib_regression=# \df crosstab List of functions Schema | Name | Result data type | Argument data types |

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-04 Thread Stefan Schwarzer
What version of PostgreSQL are you running? The error seems to indicate that you don't have the crosstab(text,text) form of the function. In psql do: contrib_regression=# \df crosstab List of functions Schema | Name | Result data type | Argument data types |

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-02 Thread Stefan Schwarzer
I need to convert the integer values for the years into column names, i.e. 1965 into y_1965. How do I achieve this then? Try something like: create table foo ( name text, year_start int, value float8); insert into foo values('a',2010,1.23),('b',2011,2.34); SELECT * FROM

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-01 Thread Stefan Schwarzer
For one of the countries, I have a value for 2007, but not for 1960. When using only the inner query, than I see one line: Andorra - 2007 - 539 But when running the whole SQL, the value for year 2007 get's allocated to the year 1960. The table looks as follows: name |y_1960|

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-01 Thread Stefan Schwarzer
For one of the countries, I have a value for 2007, but not for 1960. When using only the inner query, than I see one line: Andorra - 2007 - 539 But when running the whole SQL, the value for year 2007 get's allocated to the year 1960. The table looks as follows: name |y_1960|

[GENERAL] Problem with Crosstab - Allocating value to wrong column

2010-10-19 Thread Stefan Schwarzer
Hi there, I have a database with statistical tables which look like this: id|year_start |value 3 1960 736.1 3 1961 723.3 4 1960 123.4 Years can cover 40 years for each of the countries (ID) and each

[GENERAL] Make Install contrib/tablefunc Problems

2010-06-10 Thread Stefan Schwarzer
Hi there, strange thing, but every time I need to (re)install the tablefunc, I run into problems. I am using the Kyngchaos packages for Snow Leopard. Everything works smoothly, until I arrive at the additional, manual installation of tablefunc. I downloaded the correct version of the postgres

[GENERAL] Make Install contrib/tablefunc Problems

2010-06-10 Thread Stefan Schwarzer
Hi there, strange thing, but every time I need to (re)install the tablefunc, I run into problems. I am using the Kyngchaos packages for Snow Leopard. Everything works smoothly, until I arrive at the additional, manual installation of tablefunc. I downloaded the correct version of the postgres

[GENERAL] SELECT only those values of table B which have a value in table A

2010-02-25 Thread Stefan Schwarzer
Hi there, I have tables with values for each country of the world. Now, there is the possibility for the user to generate regional (Europe, Africa...) or subregional (Western Europe, Central Europe...) aggregations on-the-fly. In some cases, these aggregations need to be calculated by

Re: [GENERAL] SELECT only those values of table B which have a value in table A

2010-02-25 Thread Stefan Schwarzer
SELECT COALESCE(r.name, ) AS name, d.year_start AS year, SUM(d.value * d_nom.value) / SUM(d_nom.value) AS value FROM pop_total_access_water AS d

[GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread Stefan Schwarzer
Hi there, gush, shouldn't be that complicated. But neither in Postgres, nor in Access I succeed in getting the result I wish. I have a couple of times for the Environmental Conventions (Kyoto, Montreal, CITES etc.). They look like this: id_country,year,value 4,1992,0 4,1993,0 4,1994,0

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread Stefan Schwarzer
Select countries.name, basel.year, basel.value, cites.year, cites.value From countries Left Join basel on basel.id_country = countries.id_country and basel.value=1 Left Join cites on cites.id_country = countries.id_country and cites.value=1 I would have thought so, but the query turns

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread Stefan Schwarzer
Select countries.name, basel.year, basel.value, cites.year, cites.value From countries Left Join basel on basel.id_country = countries.id_country and basel.value=1 Left Join cites on cites.id_country = countries.id_country and cites.value=1 I would have thought so, but the query turns

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread Stefan Schwarzer
Select countries.name, basel.year, basel.value, cites.year, cites.value From countries Left Join basel on basel.id_country = countries.id_country and basel.value=1 Left Join cites on cites.id_country = countries.id_country and cites.value=1 I would have thought so, but the query turns

Re: [GENERAL] Subqueries or Joins? Problems with multiple table query

2010-02-23 Thread Stefan Schwarzer
You may also wish to review Andreas' suggestions as they propose a more sensible table structure rather than having a table for each convention. The table proposal really looks nice. But our database is structured by variable - so each convention has its own table. It is a really bad design -

[GENERAL] How to escape apostrophes when apostrophes already used to escape something else

2010-02-05 Thread Stefan Schwarzer
Hi there, probably not too complicated, but although googling my way through many pages, I don't find the solution. I have a query which uses already an apostrophe to escape something else: $query = SELECT * FROM

Re: [GENERAL] Make Install contrib/tablefunc Problems

2010-01-26 Thread Stefan Schwarzer
The following does basically the same thing, but I find it a bit easier to follow: sudo -u postgres /usr/local/pgsql/bin/pgsql tablefunc.sql Thanks for that. Looks indeed less complicated! :-) But not yet success for me: I did re-start, just to be sure. for postgres:

[GENERAL] Make Install contrib/tablefunc Problems

2010-01-25 Thread Stefan Schwarzer
Hi there, I deleted involuntarily my tablefunc functions in my database. Now, I am trying to get them back into it again. But without success. I am running Mac OS X, 10.5, with postgres 8.3.1 and have used the Kyngchaos packages. It seems to me that before I succeeded in doing this from

Re: [GENERAL] Make Install contrib/tablefunc Problems

2010-01-25 Thread Stefan Schwarzer
But when I do this I get this error message: Makefile:17: ../../src/Makefile.global: No such file or directory Makefile:18: /contrib/contrib-global.mk: No such file or directory make: *** No rule to make target `/contrib/contrib-global.mk'. Stop. What is the problem?

[GENERAL] How to INSERT empty line into SEQUENTIAL table from PHP

2008-06-16 Thread Stefan Schwarzer
Hi, rahter dump question, I guess But I have a table with a sequential index field, into which I would like to add from time to time another line (via webbrowser), which in turn, stays first empty, before it's being filled in later (via webbrowser). Because the ID field is

Re: [GENERAL] How to INSERT empty line into SEQUENTIAL table from PHP

2008-06-16 Thread Stefan Schwarzer
NEXTVAL('some_sequence') ). You can also insert values yourself: INSERT INTO table_xx (ID, field2, field3, field4) VALUES (NEXTVAL('some_sequence'), '', '', ''); Julius Tuskenis Stefan Schwarzer rašė: Hi, rahter dump question, I guess But I have a table with a sequential index field

Re: [GENERAL] How to INSERT empty line into SEQUENTIAL table from PHP

2008-06-16 Thread Stefan Schwarzer
error because you have previously inserted ID column with your own values. Check the sequence page_input_id_seq if it points to the right next value. If not - correct it to a MAX(ID) +1 Julius Tuskenis Stefan Schwarzer rašė: It doesn't work like this: INSERT INTO page_input (id, page

Re: [GENERAL] pg_query $result re-fill

2008-06-12 Thread Stefan Schwarzer
Here I would like to check: IF param1 75 THEN region-in-$result-should-be-set-to-NULL Not sure I get what all you're wanting to do from your message, but could you use a case statement in sql to do this? Or put it in the where clause? I knew it too be a bit complicated to explain

[GENERAL] pg_query $result re-fill

2008-06-10 Thread Stefan Schwarzer
Hi there, I used to pass a the $result of a pg_query to a function which detects min, max etc. Now, I inserted before that another query which first queries a set of parameters for the selected regions. Only if these parameters are fulfilled for each of the regions, the values of the

[GENERAL] Underscore _ in LIKE pattern

2008-05-14 Thread Stefan Schwarzer
Hi there, I would like to get a list of all tables in my schema which begin with in_. But as the underscore (_) in pattern stands for (matches) any single character, my query: SELECT * FROM pg_tables WHERE schemaname='public' AND tablename LIKE 'in_%' ORDER BY tablename ASC doesn't

[GENERAL] Substring Problem

2008-05-13 Thread Stefan Schwarzer
Hi there, it seems to work with 8.1, but not anymore with 8.3. What is wrong with this substring request? Or is it some installation issue? Thanks for any suggestion! SELECT substring(date from 1 for 7) AS stryearmonth, COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP

Re: [GENERAL] Substring Problem

2008-05-13 Thread Stefan Schwarzer
COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP BY stryearmonth ORDER BY stryearmonth ASC btw, whats the reason for the subselect? Oh, right, looks a bit stupid like this. It's eventually being filled with something more useful, upon the user's request. It's

[GENERAL] Installation of contrib/tablefunc - problems

2008-04-15 Thread Stefan Schwarzer
Hi there, small problem with installing the tablefunc libs. I have a 8.3.1 running on my Mac 10.5. Now, I would like to add tablefunc. Last time, I did it the following way: # in the downloaded postgres package directory $ ./compile # in the tablefunc dir $ USE_PGXS=1 sudo make $ USE_PGXS=1

Re: [GENERAL] Installation of contrib/tablefunc - problems

2008-04-15 Thread Stefan Schwarzer
ld: file not found: ../../src/backend/postgres It appears to be trying to link to the postgres executable (which is presumably built with --export-dynamic to usefully permit that). The postgres executable doesn't appear to be there. At a guess, the module expects to be built from a particular

Re: [GENERAL] The default text search configuration will be set to simple ?

2008-04-14 Thread Stefan Schwarzer
what does this message mean? I didn't find any information on the web, beside of others having similar messages... -- The database cluster will be initialized with locales COLLATE: en_US.UTF-8 CTYPE:UTF-8 This one is missing the en_US off the front.

Re: [GENERAL] Dump/Transfer Sequence Problems

2008-04-14 Thread Stefan Schwarzer
I am using Navicat to transfer data from one database to another. But it soon gives me an error message like the following: I think you'll probably have to ask the navicat people. If you want to use pg_dump to transfer data from 8.1 to 8.2 though, use the version of pg_dump that ships with

[GENERAL] The default text search configuration will be set to simple ?

2008-04-13 Thread Stefan Schwarzer
Hi there, what does this message mean? I didn't find any information on the web, beside of others having similar messages... -- The database cluster will be initialized with locales COLLATE: en_US.UTF-8 CTYPE:UTF-8 MESSAGES: en_US.UTF-8 MONETARY:

Re: [GENERAL] Dump/Transfer Sequence Problems

2008-04-10 Thread Stefan Schwarzer
I am using Navicat to transfer data from one database to another. But it soon gives me an error message like the following: I think you'll probably have to ask the navicat people. If you want to use pg_dump to transfer data from 8.1 to 8.2 though, use the version of pg_dump that ships with

[GENERAL] Proper Installation of Postgres and Postgis on 10.5 Intel

2008-04-10 Thread Stefan Schwarzer
I tried now for weeks to get postgres postgis going on my machine, in vain... Lots of frustration has been built up, lots of energy went into it... But nothing goes... I mean, postgres is running, postgis is installed, but it constantly craches, doesn't accept shp2pgsql imports etc...

[GENERAL] Dump/Transfer Sequence Problems

2008-04-09 Thread Stefan Schwarzer
Hi, I am using Navicat to transfer data from one database to another. But it soon gives me an error message like the following: [Err] [Dtf] Transfer Data [create table admin.news ( id int4 not null default nextval('news_id_seq1'::regclass) , date date , text_en text , text_fr text ,

[GENERAL] pg_ctl: cannot be run as root

2008-02-04 Thread Stefan Schwarzer
Hi there, I installed postgres without creating another postres user/admin than myself, as there is no other user on my machine and it's only for testing purposes. But strange enough, I only can start the postgres server from time to time, normally when I have freshly restarted the

Re: [GENERAL] Dump schema without the functions

2008-02-01 Thread Stefan Schwarzer
how can I dump a schema with all tables, but without the functions? There's no built-in single command for that. You can accomplish it by using pg_restore -l to make a list of objects, then edit the list, then pg_restore -L to restore only the objects in the edited list. Hmmm.. I probably

[GENERAL] pg_restore fails for postgis data dump

2008-02-01 Thread Stefan Schwarzer
Hi there, I just wanted to restore a dump which I did, which includes some postgis data. But, it doesn't work and instead I get this error message: pg_restore: restoring data for table boundaries_national pg_restore: [archiver (db)] error returned by PQputCopyData: server closed the

Re: [GENERAL] Forgot to dump old data before re-installing machine [solved]

2008-02-01 Thread Stefan Schwarzer
When I start the postmaster it seems ok. But there is no process running. Then it didn't really start successfully. (Unless you use the -w option, pg_ctl start just launches the postmaster --- it doesn't wait around to see what happens.) You need to look into the log file to see what the

Re: [GENERAL] Dump schema without the functions

2008-02-01 Thread Stefan Schwarzer
But I don't really get how the final command will look like. pg_restore -L file_without_FUNCTIONS -d my_database But somewhere I have to indicate the original file, no? I mean, where do all my data now come from? The original dump contains all data; the newly created via

[GENERAL] Dump schema without the functions

2008-01-31 Thread Stefan Schwarzer
Hi there, how can I dump a schema with all tables, but without the functions? Is there a way to do it, or do I have to manually drop the functions later when having used the pg_restore? Thanks for any advice, Stef smime.p7s Description: S/MIME cryptographic signature

Re: [GENERAL] Dump schema without the functions

2008-01-31 Thread Stefan Schwarzer
how can I dump a schema with all tables, but without the functions? There's no built-in single command for that. You can accomplish it by using pg_restore -l to make a list of objects, then edit the list, then pg_restore -L to restore only the objects in the edited list. Hmmm.. I probably

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-24 Thread Stefan Schwarzer
As for the real problem (on the same hardware), when you rebuilt Postgres on your new machine did you change any of the configure options that MacPorts would have used from what would have been used previously (I assume they can be overridden)? There's not that much that can be overridden that

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-24 Thread Stefan Schwarzer
On Jan 24, 2008, at 4:41 PM, Tom Lane wrote: Stefan Schwarzer [EMAIL PROTECTED] writes: After running initdb the postmaster started smoothly. I stopped it, copied my database files into the same location, started the postmaster again, and then got this error message: schwarzers-mac-mini

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-24 Thread Stefan Schwarzer
When I start the postmaster it seems ok. But there is no process running. Then it didn't really start successfully. (Unless you use the -w option, pg_ctl start just launches the postmaster --- it doesn't wait around to see what happens.) You need to look into the log file to see what the

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-18 Thread Stefan Schwarzer
Ok, it seems to be related to a Intel/PPC issue, as Martijn and Tom suggested. So, I copied all files to a PPC, but which runs Linux - don't know if this is important. Now, it tells me: Fatal error: Incorrect checksum on control file Any way out of this? Thanks for any advice. That's the

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-18 Thread Stefan Schwarzer
Did you just move from a PPC-based Mac to an Intel-based one? If so, you're out of luck --- you need to go back to the PPC to make a dump of those files. No, I just re-installed my Intel Mac. First I just upgraded from Tiger to Leopard (without getting my database to run; but I didn't

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-17 Thread Stefan Schwarzer
This looks like an endianess mismatch; did you already mention on what architecture you are on? MacPro, Leopard Did you just move from a PPC-based Mac to an Intel-based one? If so, you're out of luck --- you need to go back to the PPC to make a dump of those files. No, I just

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-17 Thread Stefan Schwarzer
This looks like an endianess mismatch; did you already mention on what architecture you are on? MacPro, Leopard Did you just move from a PPC-based Mac to an Intel-based one? If so, you're out of luck --- you need to go back to the PPC to make a dump of those files. No, I just

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-16 Thread Stefan Schwarzer
Ok, did what you said: stopping server, deleting newly created data directory, re-running initdb, starting the server, stopping the server. Renamed empty data directory. Restarting server: NOT COMPLAINING you need to run initdb or something else Although it's saying that it starts,

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-16 Thread Stefan Schwarzer
| The logfile is telling me this when I try to start the server with my | old data folder: | | FATAL: database files are incompatible with server | DETAIL: The database cluster was initialized with PG_CONTROL_VERSION | 738394112, but the server was compiled with PG_CONTROL_VERSION 812. | |

[GENERAL] Postgres installation on Leopard; database on Mac-User-Level

2008-01-15 Thread Stefan Schwarzer
Hi there, I want to create my database not under /etc/ but under or within my Mac-user level, that is /Users/schwarzer/ Now, it seems somewhat complicated - at least for me -, due to the different read-write permissions, to do that. It worked before, but now, after re-installing

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-15 Thread Stefan Schwarzer
I re-installed my machine and forgot to dump my database(s). I naturally still have the whole database folders. For the moment I installed the old postgres version (8.1) to be able to read my data. But how can I read them? It seems that it doesn't work that I just overwrite the new database

Re: [GENERAL] Postgres installation on Leopard; database on Mac-User-Level

2008-01-15 Thread Stefan Schwarzer
Now, it seems somewhat complicated - at least for me -, due to the different read-write permissions, to do that. It worked before, but now, after re-installing the machine, I really don't get it going... The commands would be like this: /usr/local/pgsql/bin/initdb -D

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-15 Thread Stefan Schwarzer
I re-installed my machine and forgot to dump my database(s). I naturally still have the whole database folders. For the moment I installed the old postgres version (8.1) to be able to read my data. But how can I read them? It seems that it doesn't work that I just overwrite the new database

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-15 Thread Stefan Schwarzer
Ok, did what you said: stopping server, deleting newly created data directory, re-running initdb, starting the server, stopping the server. Renamed empty data directory. Restarting server: NOT COMPLAINING you need to run initdb or something else Although it's saying that it starts,

Re: [GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-14 Thread Stefan Schwarzer
I'm wondering if some of those files are missing, or the symlinks are dangling, on yours. Hmmm. here is what I have. Looks pretty similar Running out of easy answers, aren't we :-( The next thing I can think of is to run initdb under ktrace -i and compare the results with a

[GENERAL] Forgot to dump old data before re-installing machine

2008-01-14 Thread Stefan Schwarzer
Hi there, I re-installed my machine and forgot to dump my database(s). I naturally still have the whole database folders. For the moment I installed the old postgres version (8.1) to be able to read my data. But how can I read them? It seems that it doesn't work that I just overwrite the

Re: [GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-10 Thread Stefan Schwarzer
FATAL: XX000: failed to initialize lc_messages to LOCATION: InitializeGUCOptions, guc.c:2666 Typically what this means is that you have an improper setting of LANG or LC_ALL in your environment (improper meaning that it doesn't match any of the locales that are actually installed on your

Re: [GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-10 Thread Stefan Schwarzer
FATAL: XX000: failed to initialize lc_messages to LOCATION: InitializeGUCOptions, guc.c:2666 Typically what this means is that you have an improper setting of LANG or LC_ALL in your environment (improper meaning that it doesn't match any of the locales that are actually installed on your

Re: [GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-10 Thread Stefan Schwarzer
/usr/local/pgsql/bin/initdb -D --locale=en_US.UTF-8 /Users/ schwarzer/Documents/data_postgres Dunno if it'll make a difference, but I'd put the -D immediately before the path to the data directory. Thanks for the hint. But unfortunately same error message

Re: [GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-10 Thread Stefan Schwarzer
/usr/local/pgsql/bin/initdb -D --locale=en_US.UTF-8 /Users/schwarzer/Documents/data_postgres Dunno if it'll make a difference, but I'd put the -D immediately before the path to the data directory. Also, pay attention to the first few lines of initdb output --- it will tell you what it thinks

Re: [GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-10 Thread Stefan Schwarzer
g42:~ tgl$ ls -lR /usr/share/locale/en_US.UTF-8 total 40 lrwxr-xr-x 1 root wheel 28 Apr 26 2006 LC_COLLATE - ../ la_LN.US-ASCII/LC_COLLATE lrwxr-xr-x 1 root wheel 17 Apr 26 2006 LC_CTYPE - ../UTF-8/ LC_CTYPE drwxr-xr-x 3 root wheel 102 Mar 20 2005 LC_MESSAGES lrwxr-xr-x 1

[GENERAL] Installation problem: failed to initialize lc_messages to

2008-01-09 Thread Stefan Schwarzer
Hi there, I am trying to install Postgres 8.1.11 on Mac Leopard. Compilation was ok. Now, the initdb has some problems: $ /usr/local/pgsql/bin/initdb -D --locale=C /Users/schwarzer/Documents/ data_postgres ... selecting default max_connections ... 10 selecting default shared_buffers ...

[GENERAL] UNION not working... why?

2007-12-13 Thread Stefan Schwarzer
Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography http://photoblog.la-famille-schwarzer.de Appetite for Global Data? UNEP GEO Data Portal: http://geodata.grid.unep.ch

Re: [GENERAL] UNION not working... why?

2007-12-13 Thread Stefan Schwarzer
Oh great. Thanks a lot. But now, I have another problem in this context. If I use text in the SELECT statement (so, that the final output gives me the name of the selected variables, plus the year and the value) than I get this error message: ERROR: failed to find conversion function from

Re: [GENERAL] UNION not working... why?

2007-12-13 Thread Stefan Schwarzer
But now, I have another problem in this context. If I use text in the SELECT statement (so, that the final output gives me the name of the selected variables, plus the year and the value) than I get this error message: ERROR: failed to find conversion function from unknown to text [squint...]

Re: [GENERAL] Substitute column in SELECT with static value? (Crosstab problem?)

2007-11-18 Thread Stefan Schwarzer
Hi there, I run an aggregation on national statistics to retrieve regional values (for Africa, Europe, ...). Now, I want to have a global aggregation as well. The easiest thing for my PHP/HTML procedure would be to have the global row make appear within the regional result. So it would

[GENERAL] Substitute column in SELECT with static value?

2007-11-16 Thread Stefan Schwarzer
value, such as Global? So, that the query still results in three columns? Thanks for any advice! Stef Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography: http://photoblog.la-famille-schwarzer.de

[GENERAL] (Never?) Kill Postmaster?

2007-10-24 Thread Stefan Schwarzer
Hi there, I read dozens of times the TIP 2: Don't 'kill -9' the postmaster... Now, what am I supposed to do if I launched a query which takes ages, and which I want to interrupt? Thanks for any advice, Stef Stefan

[GENERAL] Concatenate two queries - how?

2007-10-24 Thread Stefan Schwarzer
Hi there, I have two queries, which I would like to bring together to form one result. The first query is a simple SELECT on a table of national statistics. SELECT COALESCE(c.name, ), year_start AS year, value FROM fish_catch AS d LEFT JOIN

Re: [GENERAL] Crosstab Problems

2007-10-19 Thread Stefan Schwarzer
But when re-doing the query now without the JOIN, it works (almost): SELECT * FROM crosstab( 'SELECT id_country AS id, year_start AS year, value FROM agri_area AS d WHERE year_start = 2003 OR year_start =

[GENERAL] Crosstab Problems

2007-10-18 Thread Stefan Schwarzer
Hi there, successfully installed the tablefunc package. Now, I would like to transform this kind of result based on a normal SQL: c_name |year|value --- Germany | 2001| 123 Germany | 2002| 125 Germany

  1   2   >