Re: [SQL] Differences between bit string constant sintax

2009-09-10 Thread Jasen Betts
On 2009-09-09, Oliveiros C,  wrote:
> This is a multi-part message in MIME format.
>
> --=_NextPart_000_013B_01CA3146.85B62920
> Content-Type: text/plain;
>   charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Dear All,
>
> I have a table which has a field that is of type bit varying.
>
> When I do a direct INSERT with , say, X'1F', everything
> works fine.

copy syntax differs from literal syntax in several ways
(an obvious one is that tabs are allowed in literals)
in this case you don't use quotes in the value.


copy mytable from stdin;
4 xdeadbeef
5 x123
\.
 


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


[SQL] Trapping 'invalid input syntax for integer'

2009-09-10 Thread Mario Splivalo
Is there a way to trap this error in plpgsql code?

I have a function that accepts integer and character varying. Inside
that function I need to cast that varchar to integer. Of course,
sometimes that is not possible.
When I run function like that, I get this errror:

fidel=# select * from get_account_info_by_tan(1, 'mario');
ERROR:  invalid input syntax for integer: "mario"
CONTEXT:  SQL statement "SELECT  user_id FROM user_tans WHERE user_tan =
 $1 ::bigint"
PL/pgSQL function "get_account_info_by_tan" line 8 at assignment

Now, I know I could change the SELECT so it looks like:

SELECT user_id FROM user_tans WHERE user_tan::varchar = $1

But, is there a way to trap above error usin EXCEPTION WHEN keyword in
plpgsql?

Mike

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


Re: [SQL] Trapping 'invalid input syntax for integer'

2009-09-10 Thread Marcin Krawczyk
Hi, I believe you're looking for invalid_text_representation.
EXCEPTION WHEN invalid_text_representation THEN


regards
mk


2009/9/10 Mario Splivalo 

> Is there a way to trap this error in plpgsql code?
>
> I have a function that accepts integer and character varying. Inside
> that function I need to cast that varchar to integer. Of course,
> sometimes that is not possible.
> When I run function like that, I get this errror:
>
> fidel=# select * from get_account_info_by_tan(1, 'mario');
> ERROR:  invalid input syntax for integer: "mario"
> CONTEXT:  SQL statement "SELECT  user_id FROM user_tans WHERE user_tan =
>  $1 ::bigint"
> PL/pgSQL function "get_account_info_by_tan" line 8 at assignment
>
> Now, I know I could change the SELECT so it looks like:
>
> SELECT user_id FROM user_tans WHERE user_tan::varchar = $1
>
> But, is there a way to trap above error usin EXCEPTION WHEN keyword in
> plpgsql?
>
>Mike
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>


Re: [SQL] Trapping 'invalid input syntax for integer'

2009-09-10 Thread Mario Splivalo
Marcin Krawczyk wrote:
> Hi, I believe you're looking for invalid_text_representation.
> 
> EXCEPTION WHEN invalid_text_representation THEN
> 

Thnx, that is it.

Mike

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


Re: [SQL] how to: refer to select list calculations other places in the calculations.

2009-09-10 Thread Rob Sargent
I might do the substitution, analyse the query and hope to break it up. 
Can it possibly be optimal?


Little, Douglas wrote:
Hi Rob, 
Thanks for the response.
Repeating the base calculation will work but the calculations are  stunningly complex and long.  Repeating them will undoubtly increase editing errors and maintenance problems. 


Wish I had a sample to post.  Last query I analyzed was approx 10k lines and 
printed to over 50 pages.   Yes, it was a single query.  I'm amazed that cognos 
would generate.  Basically they generate a pivoted cross-tab from sql.

Thanks
Doug




-Original Message-
From: Rob Sargent [mailto:robjsarg...@gmail.com] 
Sent: Wednesday, September 09, 2009 11:59 PM

To: Little, Douglas
Subject: Re: [SQL] how to: refer to select list calculations other places in 
the calculations.

Would reverting to the base columns work?

select a, b, a+b as c, (a+b)*d, (a+b)*f etc.

Little, Douglas wrote:
  

Hi,

I have very complex sql (generated by cognos) I'm porting from 
Teradata that basically uses column alias in the calculated columns.


Is there any way to do this type of thing in Psql?

Essentially I need to do is refer to a calculated column later in the 
select list (but far more complex - like 50 pages printed out)


sel a,b,a+b as c, c*d, c*f, c*g, c*h, c*I, c*j, c*k,.. --- where c is 
a calculated column used in other calculations.


from 

**Doug Little**

Sr. Data Warehouse Architect | Enterprise Data Management | Orbitz 
Worldwide


500 W. Madison, Suite 1000 Chicago IL 60661| Office 312.260.2588 | Fax 
312.894.5164 | Cell 847-997-5741



  ***douglas.lit...@orbitz.com* **__

orbitz.com  | ebookers.com 
 | hotelclub.com  
| cheaptickets.com  | ratestogo.com 
 | asiahotels.com 





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


[SQL] Encryption in the tables of a Postgres 7.3.2 database

2009-09-10 Thread jtayamai
Hi,

I've a Postgres DB release 7.3.2 and some developed C++ and PHP code
so as to communicate with it.

Currently, the data I've in the different tables is stored with no
encription at all, and I was wondering if there would be an easy way
to get it encrypted without major changes in the already developed C++/
PHP code.

I mean, I want to replace the non-encrypted database with an encrypted
version of it without C++/PHP programmes noticing it.

Has anyone any suggestion about the easiest way to do it?

Thanks.

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


[SQL] Talend : Talend Integration Suite vs Talend Open Studio

2009-09-10 Thread Rstat


Hi all, 

I have been working with Talend Open Studio for a few weeks now and would
like to have your opinion. 

Is using Talend Integration Suite really better compared to using Talend
Open Studio? On what kind of project can you not use Talend Open Studio and
would be best to use Talend Integration Suite? 

Thanks a lot for your answers. 
Have a good day!
-- 
View this message in context: 
http://www.nabble.com/Talend-%3A-Talend-Integration-Suite-vs-Talend-Open-Studio-tp25382800p25382800.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


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