[GENERAL] OK, when 8.3 is coming?

2007-09-29 Thread Anton Andreev

Hi,

Has someone stated when is Postgresql 8.3 coming?

Anton


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [GENERAL] Please change default characterset for database cluster

2007-09-30 Thread Anton Andreev

Hi,

Get a VPS - Virtual Private Server. Mine is 29$ and it is fine for 480MB
RAM and enough disk space.  I am a full admin on my server, so I install
and configure Postgresql without problem.

YES! I agree that the default encoding must be UTF-8. I started using
Postgresql, cause I had problems with encodings in Mysql! :)

p.s. I had problems indeed. On my VPS I am unable to change the language
for non-unicode programs, so it is left to English United States, which
bothers Postgresql with my database encoding WIN, but that is another story.

Ron Johnson wrote:

On 09/30/07 10:31, brian wrote:
[snip]
  

The default for MySQL is latin1 with swedish sorting.



Yorn desh born, der ritt de gitt der gue
Orn desh, dee born desh, de umn børk! børk! børk!

  




---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] Sql problem

2007-10-07 Thread Anton Andreev

Hi,

Can you tell me more about Postgresql string functions?
I want to replace a column text "1/2/3/8/" to the corresponding values 
to these values like "A, B, C, D".



Cheers,
Anton Andreev


---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org/


[GENERAL] day of week

2007-11-01 Thread Anton Andreev

Hi,

I have records with date column. Is there a way I can get which day of 
week this date is?


Cheers,
Anton

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


[GENERAL] safely increase a single column integer value

2007-11-05 Thread Anton Andreev

Hi,

What is the best way from concurrency point of view to increase a 
integer value from a table?


Suppose you count every postback from all the users that are currently 
browsing your web-site.


Cheers,
Anton


---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


[GENERAL] returning a resultset from a function

2008-02-15 Thread Anton Andreev

Hi,

How do I return a result set? Is there a better way in 'plpgsql' than 
the one described below?
I do not want to make a select from a function(which pretty useful in 
many cases):

SELECT * FROM getfoo();
, but I want to just call the function with SELECT getfoo();


--DROP FUNCTION getfoo();
--DROP type compfoo;

CREATE TYPE compfoo AS (f1 integer,f2 integer);

CREATE OR REPLACE FUNCTION getfoo() RETURNS SETOF compfoo
AS
$BODY$
declare
   ret_row record;
BEGIN

FOR ret_row IN SELECT id,mun_id FROM mytable LOOP

 RETURN next ret_row;

END LOOP;

RETURN;

END;
$BODY$
 LANGUAGE 'plpgsql';




[GENERAL] Question about the cluster command

2008-03-13 Thread Anton Andreev

Hi,

Can I cluster the tuples in a table like that:

group by company_id order by opendate desc

How do I create an index representing the above logic to use it with the 
cluster command. Can I automate the clustering process to best optimize 
my database performance and always get the data about a specific company 
ordered by date as fast as possible (to generate charts). Does 
autovacuum include reclustering?


Cheers,
Anton Andreev


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] How to "use" database?

2008-03-25 Thread Anton Andreev

Hi,

How to use a database I have just created  in a script that  I am 
executing in Pgadmin3 on Windows?

I can not use "USE Northwind;" or "\connect Northwind;"?

Cheers,
Anton

--
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 to "use" database?

2008-03-27 Thread Anton Andreev

Hi,

Thank you for you detailed answer, but I am exactly in the case when I 
want to paste the script and hit F5 and have both the database and 
tables created.


A problem also comes from the fact that in order to use the query window 
in pgadmin3, you need to select a database. Then when you create a new 
database you can not access it by name cause you receive an error "cross 
database referencing is not allowed".


Cheers,
Anton

Shane Ambler wrote:

Anton Andreev wrote:

Hi,

How to use a database I have just created  in a script that  I am 
executing in Pgadmin3 on Windows?


If you are in pgAdmin then you don't need the connect command. When 
you select the db from the side list it connects you and lists the 
contents of the db.
From the query window in pgAdmin (where you can enter any sql 
statements) which is where I think you are opening your script file, 
it will have a popup menu that you can choose the db to run the 
commands on (or the sql script you are opening).



I can not use "USE Northwind;" or "\connect Northwind;"?


I believe you get the USE command from MS SQL Server examples - 
postgres doesn't have that command.


The \connect is a 'shell' command used in psql - the cli based 
postgres client that comes with postgresql. This would not be 
recognised in the pgAdmin query window, which would only accept valid 
SQL statements.



I am thinking that if you are writing a script that creates a db then 
wants to connect to it and create tables etc, you should look at 
sending it to psql.


From a dos prompt you can use something like -
psql -U postgres -W -f myscript.sql


If you start psql then you can use the psql command \i myscript.sql to 
run the script.


You may need to add full pathnames in these examples.





--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] very slow updates in 8.3?

2008-04-19 Thread Anton Andreev

Hi,

I have noticed that the first time you execute an:

update table1 set params_count=0;

it takes too long to complete: 11000 rows - 100 s.

Postgresql 8.3 configuration on Turion 64 with 1.4 Gb RAM, Windows XP

Which compiler is used to build Postgresql on Windows? Is it 9?

Any comment?


Cheers,
Anton


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] problem with check constraints

2008-10-10 Thread Anton Andreev

Hi,

When I create a check constraint in PgAdmin3 1.8.4 on a Postgresql 
8.3.3: ((A and B) or (C and D))

I get with create script: (A and B or C and D) which is wrong.

Please help.

Cheers,
Anton


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] pgsql-general@postgresql.org

2007-04-24 Thread Anton Andreev

Hi,

I am trying to use cursors and I am really frustrated already. Do  I
need to install an extension?

1. Problem number one is that what ever I use in front of the fetch
command it is not being accepted, it gives a syntax error. If I use a
number ,"all" or "forward" it gives an error again?? I want to
do something like the code below:

CREATE OR REPLACE FUNCTION database_correction()
 RETURNS double precision AS
$BODY$
DECLARE
   mycursor CURSOR FOR select distinct(fund_id) from
"NAV_values_bfb_history";
   iterator integer;

BEGIN
open mycursor;

FETCH mycursor INTO iterator;

--fetch next  from  mycursor  --gives  an error

WHILE (FETCH next from mycursor) LOOP
   -- some computations here
END LOOP;

CLOSE mycursor;
END;

2. What is the right way to check that the cursor has ended. In
sqlserver there is a variable "@@fetch_status". I have to make here some
comparison in the while clause, but I am not sure what it should be. I
could not find a single example for cursor in a loop.

I will greatly appreciate any help, pgsql is my database of choice.

Cheers,
Anton



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] [pgadmin-support] questions about cursors

2007-04-24 Thread Anton Andreev


I did already, but this still does not help me write a simple while loop 
that goes through all data and stops at the last row.


Joris Dobbelsteen wrote:

See the postgresql documentation at:
http://www.postgresql.org/docs/8.2/interactive/plpgsql-cursors.html 

  

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of 
Anton Andreev

Sent: dinsdag 24 april 2007 13:45
To: [EMAIL PROTECTED]
Subject: [pgadmin-support] questions about cursors

Hi,

I am trying to use cursors and I am really frustrated already. 
Do  I need to install an extension?


1. Problem number one is that what ever I use in front of the 
fetch command it is not being accepted, it gives a syntax 
error. If I use a number ,"all" or "forward" it gives an error 
again?? I want to do something like the code below:


CREATE OR REPLACE FUNCTION database_correction()
 RETURNS double precision AS
$BODY$
DECLARE
   mycursor CURSOR FOR select distinct(fund_id) from 
"NAV_values_bfb_history";

   iterator integer;

BEGIN
open mycursor;



Please see chapter 37.8.3.1 "FETCH" (in the 8.2 documentation).
Important for you is: "As with SELECT INTO, the special variable FOUND
may be checked to see whether a row was obtained or not."


  

FETCH mycursor INTO iterator;

--fetch next  from  mycursor  --gives  an error




WHILE (FOUND) LOOP
-- compute
FETCH mycursor INTO interator;
END LOOP;

-- instead of
  

WHILE (FETCH next from mycursor) LOOP
   -- some computations here
END LOOP;



I believe this should work. I've never really used cursors before, as I
can usually do it with regular SQL statements (which are usually
faster).
I should also advise that you can create your own aggregate (see CREATE
AGGREGATE in the documentation), which might, or might not, be easier
for your purposes.

  

CLOSE mycursor;
END;

2. What is the right way to check that the cursor has ended. 
In sqlserver there is a variable "@@fetch_status". I have to 
make here some comparison in the while clause, but I am not 
sure what it should be. I could not find a single example for 
cursor in a loop.



When FOUND evaluates to false, you should have completed. (In case of
errors, you will probably have an exception being thrown).

  

I will greatly appreciate any help, pgsql is my database of choice.



Hope this helps...

- Joris



  



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[GENERAL] posting request

2006-04-13 Thread Anton Andreev

  I want to post some questions.



---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match


[GENERAL] table as hashtable

2006-04-13 Thread Anton Andreev


 Hi,

Can I use a Postgre table as hashtable\\?

when I do select where column='test', I want this to be done by hashtable,
not linear, not by b-tree. I do not need to sort, sum or else I just want
to get the value as fast as possible.

10x to anyone answering me

Cheers,
Anton



---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq