[GENERAL] Problem with selecting the first day of the the week

2008-10-29 Thread x asasaxax
Hi, I need a function to select the first day of the week. For example giving today´s date(29/10/2008). Can anyone help´s me? Thanks!

[GENERAL] Problem with sql

2008-10-28 Thread x asasaxax
Hi everyone, I have two tables: table_1: product_code, atualization_date table_2: id, date, value I need to get the value of table 2 that has the greatest date that is minor that atualization_date. The select should return something like that: unique product_code´s, with their atualization_d

[GENERAL] Multiple querys

2008-09-29 Thread x asasaxax
Hi everyone, I have multiple query´s, and i´m trying to optimize my queries by creating a temporary table x(contains the field id_product). The queries that utilize the temp table x, must use the order of the rows at x. My problem: I have a query that do a limit and offset on table x. I would

[GENERAL] Doubt on query

2008-09-25 Thread x asasaxax
Hi everyone, I have this table: create table cat( cod integer, cod_super integer, constraint cod_super_fk Foreign Key(cod_super) references cat(cod), constraint cod_pk Primary Key(cod) ); insert into cat values(0, 1); insert into cat values(1, 0); insert into cat values(2, 0); insert into

[GENERAL] Update tsvector trigger

2008-08-05 Thread x asasaxax
Hi, i´m trying to do a trigger that its called when update or insert, that update the tsvectors, for text-search. Here´s my code: create table x( cod serial, texto text, vectors tsvector, constraint pk primary key(cod) ); CREATE OR REPLACE FUNCTION atualiza_vectors() RETURNS trigger AS $$

[GENERAL] Table X its full, what can i do now?

2008-07-09 Thread x asasaxax
Hi everyone, I have the following sql script: CREATE SEQUENCE "public"."teste_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 32767 START 1 CACHE 1 CYCLE; CREATE TABLE "public"."teste" ( "id" SMALLINT DEFAULT nextval('teste_seq'::regclass) NOT NULL, CONSTRAINT "id_pk" PRIMARY KEY("id") )

[GENERAL] Problems with postgresql 8.3 installation

2008-04-24 Thread x asasaxax
Hi, I´m using windows vista 64 bits. And i tried to install the postgresql 8.3, but it show this error: "cannot run initdb 1!". I don´t know whats going on... help-me please Thanks

[GENERAL] SQL error

2008-04-19 Thread x asasaxax
HI everyone, I´m trying to capture all the possible errors that a statement can have. And, if there´s any error i will do a rollback; What i´m trying to do its: BEGIN insert into temp values(1, 2, 3); IF ANY_ERROR_OCCURED THEN ROLLBACK; RETURN FALSE; END IF; END; Did anyone knows

[GENERAL] Primary Key with auto increment field

2008-04-01 Thread x asasaxax
I would like to increment one field, depending of the value of the other. here´s an example: id variable 1 1 2 1 1 2 2 2 can i do that with the following commands? SELECT setval('sequence',(SELECT max(id) FROM table)) INTO variable; insert into table values(variable, ...,

Re: [GENERAL] Primary Key with serial the solution?

2008-04-01 Thread x asasaxax
d to use a sequence anymore. Is that correct? Thanks you all. 2008/3/31, x asasaxax <[EMAIL PROTECTED]>: > > can anyone do a example for me.. an explain how it works? > > Thanks a lot > > > 2008/3/29, Berend Tober <[EMAIL PROTECTED]>: > > > > x asasax

Re: [GENERAL] Primary Key with serial

2008-03-31 Thread x asasaxax
can anyone do a example for me.. an explain how it works? Thanks a lot 2008/3/29, Berend Tober <[EMAIL PROTECTED]>: > > x asasaxax wrote: > >I have the following tablecreate table product(cod serial, > user_cod > > bigint, constraint product_fk Foreign Key(

[GENERAL] Primary Key with serial

2008-03-28 Thread x asasaxax
Hi, I have the following tablecreate table product(cod serial, user_cod bigint, constraint product_fk Foreign Key(user_cod) references user(cod), constraint product_pk Primary Key(cod, user_cod)); What i want to happend is that: user_codcod 1 1 1

[GENERAL] Satisfactory Query Time

2008-01-13 Thread x asasaxax
Hi, I have a query that takes 0.450 ms. Its a xml query. Is that a good time for a query? If a have multiple connections on the database, will this time makes my db slow? How much time is good for a xml query? Thanks

Re: [GENERAL] XML path function

2008-01-09 Thread x asasaxax
Can you tell me, in how much time did the query will take with indexes + tsearch2? How much time take a satisfactory query? Can you show me some examples with tsearch2 and xml indexes? Thanks

Re: [GENERAL] XML path function

2008-01-09 Thread x asasaxax
My Postgre version its the 8.2. I´ve reached to do the path i wanted, but when i do a explain analyze on the select it return 500 miliseconds. Is this a good search? Is there a way to slow down this time with postgre 8.3? What is a good time for xml xpath´s? Thanks 2008/1/8, x asasaxax <[EM

[GENERAL] XML path function

2008-01-08 Thread x asasaxax
Hi everyone, I´m trying to undestand how to do select with xml path. I have this xml example: create table temp(id integer, xml text, Primary Key(id));

[GENERAL] Problems with acessing xml functions on other database

2007-12-09 Thread x asasaxax
Hi everyone, I had the folowing problem: when i try to execute a xml_string function on a database 'a' it works, but when i try this in database 'b' it doesen´t works. Did anyone knows what its going on? Is that some kind of permission? Thanks a lot

Re: [GENERAL] Transaction problem

2007-12-04 Thread x asasaxax
Its just use a constraint then? there´s no problem id two sessions decrease the number, and this number goes to less then or equals as zero? I´m programming with php. Thanks 2007/12/3, Cesar Alvarez <[EMAIL PROTECTED]>: > > What are you programing with?. > are you using npgsql? > > Regards Cesa

[GENERAL] Transaction problem

2007-12-03 Thread x asasaxax
Hi everyone, I would like to know how can i do a simple transaction for this situation: I have n products in certain row of a table. When the user buys a product, the quantity of this product will be decreased. The user can only buy a product that has a quantity n > 0. This means that when the

Re: [GENERAL] Postgre and XML

2007-11-19 Thread x asasaxax
rote: > > Am Montag, 19. November 2007 schrieb x asasaxax: > > >I?m interested in running xml with postgre. I use postgre version > 8.2 > > > and windows xp. I would like to know how can i enable the xml in the > > > postgresql. > > > > That depends o

[GENERAL] Postgre and XML

2007-11-19 Thread x asasaxax
Hi, I´m interested in running xml with postgre. I use postgre version 8.2 and windows xp. I would like to know how can i enable the xml in the postgresql. Did you know if its secure to use this xml function of postgre in commercial applications? How much trustable its this module? Can anyo