[SQL] Sybase Connection_Property('number') equivalent in PostGre ?

2005-12-02 Thread Emil Rachovsky

  I am trying to find out the PostGre equivalent to
the Sybase function Connection_Property (which returns
the connection id, given the parameter 'number') ,but
without success so far. Can anyone tell me how to
retrieve the connection id in PostGre?
 Thanks in advance,
Emil



__ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs

---(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


[SQL] lost in system tables

2005-12-06 Thread Emil Rachovsky

 I am trying to find the equivalent of these two
Sybase system columns :

check_on_commit (Y/N)  -  Indicates whether INSERT and
UPDATE commands should wait until the next COMMIT
command to check if foreign keys are valid. A foreign
key is valid if, for each row in the foreign table,
the values in the columns of the foreign key either
contain the NULL value or match the primary key values
in some row of the primary table.

nulls (Y/N)  -  Indicates whether the columns in the
foreign key are allowed to contain the NULL value.
Note that this setting is independent of the nulls
setting in the columns contained in the foreign key.

 Maybe pg_constaint.condeferrable is appropriate for
check_on_commit? I'll appreciate any help

Thanks in advance,
Emil





__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 


---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [SQL] lost in system tables

2005-12-06 Thread Emil Rachovsky

 Thank you,Tom,
As for the description of 'nulls' I have taken it as
it is from the Sybase help file :) 





__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 


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


Re: [SQL] [GENERAL] lost in system tables

2005-12-06 Thread Emil Rachovsky
> Those parameters are specified when you declare the
> foreign key.  Look here, 
> in the section describing "references":
>
http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
> 
> Luca

Thank you,Luca
I know that these parameters are specified when you
declare the foreign key, but i need to check them out
later from the system tables. The first one must be
something like the 'deferrable' column in
pg_constaint, but the second is still in vague.

Emil



__ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com 


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[SQL] Question on indexes

2005-12-19 Thread Emil Rachovsky

Hi,
Can anyone show me a simple way of creating an index
in PostGre like that:
create index indName on someTable(someIntColumn DESC)
?

Thanks In Advance,
Emil 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

   http://archives.postgresql.org


[SQL] bug with if ... then ... clause in views

2006-01-18 Thread Emil Rachovsky
While trying to create some views I stumbled on some
problem with using the if-then clause. Here is a
simple example : 

CREATE OR REPLACE VIEW public.SomeView
  as select d.id,
  if (true) then d.DocNumber endif from
public.Z_Documents as d;

I get the following error :
 syntax error at or near "then" at character 72

I don't have a clue what is going on here. Any
suggestions?

Thanks in advance,
Emil

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[SQL] How to find a temporary table

2006-01-27 Thread Emil Rachovsky

Hi,
I am using PostgreSQL 8.1.0 . How can I find a temp
table from my session, having the name of the table?
Can anyone show me what query should I execute? I've
tried some things but I receive mixed results of
tables from different sessions, which is strange.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

   http://archives.postgresql.org


[SQL] Without OIDs

2006-03-02 Thread Emil Rachovsky
Hello,

I'm creating a temporary table in a function and using
Alter Table ... Without OIDs, but when the function is
called for the second time I get an error "relation
with OIDs ... doesn't exist" on an insert statement to
the table. I'm using Postgre 8.0 which says that
supports without OIDs. Any suggestions?  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

   http://archives.postgresql.org


[SQL] problem with overloading the "coalesce" function

2006-03-06 Thread Emil Rachovsky


 Hi,
I am trying to overload the "coalesce" function to
accept an integer and a string. Here it is :

CREATE OR REPLACE FUNCTION "coalesce"(a int4, b
"varchar")
  RETURNS "varchar" AS
$BODY$
begin
 if (a is null ) then 
   return b;
 else 
  return cast(a as varchar(15));
end if;
end
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "coalesce"(a int4, b "varchar") OWNER
TO postgres;

I have added it to pg_catalog, but still I cant't use
it, I get an error on the second parameter, apparently
the function gets lost at some point. Any additional
steps I need to complete?

Thanks in advance,
Emil

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

   http://archives.postgresql.org


Re: [SQL] [GENERAL] problem with overloading the "coalesce" function

2006-03-06 Thread Emil Rachovsky


--- Richard Huxton  wrote:

> Emil Rachovsky wrote:
> > 
> >  Hi,
> > I am trying to overload the "coalesce" function to
> > accept an integer and a string. Here it is :
> > 
> > CREATE OR REPLACE FUNCTION "coalesce"(a int4, b
> > "varchar")
> >   RETURNS "varchar" AS
> ...
> > I have added it to pg_catalog, but still I cant't
> use
> > it, I get an error on the second parameter
> 
> What is the error?

The error is :  invalid input syntax for integer
That is,it expects an integer as a second parameter,
since the first is an integer.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

   http://archives.postgresql.org


[SQL] Syntax error in Execute statement

2006-03-06 Thread Emil Rachovsky
Hello,

I created a function "coalescec" which behaves the
same as coalesce, but uses an integer and a string.
Now I'm getting an error in the folowing statements : 
  

query := 'select "UID" from S_Users_To_Connection
where ConnID = ' || coalescec(conn_id,'null');
execute query into nUID;

ERROR:  syntax error at or near "$2" at character 20
QUERY:  SELECT   $1  into  $2 

I have put UID in quotes because it seems to be a
keyword. 

Here is the table script: 

create TEMP table S_Users_To_Connection(
 UID integer NOT NULL
,ConnID integer NOT NULL
,LoginID integer NOT NULL
);

Any suggestions ?

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

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


[SQL] Errors ignored on restore

2006-03-08 Thread Emil Rachovsky
Hi,

I'm transfering data between postgre 8.0 and 8.1 using
pg_dump and pg_restore, but I get "x errors ignored on
restore". What could be the reason ?  

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

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