Re: [GENERAL] Converting BYTEA from/to BIGINT

2010-07-27 Thread Vincenzo Romano
2010/7/27 Dimitri Fontaine : > Vincenzo Romano writes: >> Now, why doing this? >> I am using a plain SEQUENCE to create a (kind of) "session ID". That >> is simple but predictable. >> The idea is to use this function in conjunction with encrypt (from >> pgcrypto) and the blowfish algorithm >> to m

Re: [GENERAL] Converting BYTEA from/to BIGINT

2010-07-27 Thread Dimitri Fontaine
Vincenzo Romano writes: > Now, why doing this? > I am using a plain SEQUENCE to create a (kind of) "session ID". That > is simple but predictable. > The idea is to use this function in conjunction with encrypt (from > pgcrypto) and the blowfish algorithm > to make that sequence numbers somehow unp

Re: [GENERAL] Converting BYTEA from/to BIGINT

2010-07-26 Thread Vincenzo Romano
2010/7/26 Vincenzo Romano : > 2010/7/26 Pavel Stehule : >> Hello >> >> you can try >> >> postgres=# select int8send(256); >>      int8send >> >>  \x0100 >> (1 row) >> >> for converting from bytea to int8 you need a custom function - probably in C >> :( > > int8send

Re: [GENERAL] Converting BYTEA from/to BIGINT

2010-07-26 Thread Vincenzo Romano
2010/7/26 Pavel Stehule : > Hello > > you can try > > postgres=# select int8send(256); >      int8send > >  \x0100 > (1 row) > > for converting from bytea to int8 you need a custom function - probably in C > :( int8send? -- Vincenzo Romano NotOrAnd Information T

Re: [GENERAL] Converting BYTEA from/to BIGINT

2010-07-26 Thread Vincenzo Romano
2010/7/26 Vincenzo Romano : > Hi all. > > I'd like to convert an 8-bytes BYTEA into a BIGINT and possibly vice versa. > Is there any way to do it? Something like: CREATE OR REPLACE FUNCTION bytea_to_int8( ba BYTEA, OUT res INT8 ) LANGUAGE plpgsql STRICT AS $BODY$ DECLARE i INT; BEGIN res := 0

Re: [GENERAL] Converting BYTEA from/to BIGINT

2010-07-26 Thread Pavel Stehule
Hello you can try postgres=# select int8send(256); int8send \x0100 (1 row) for converting from bytea to int8 you need a custom function - probably in C :( Pavel 2010/7/26 Vincenzo Romano : > Hi all. > > I'd like to convert an 8-bytes BYTEA into a BIGINT

[GENERAL] Converting BYTEA from/to BIGINT

2010-07-26 Thread Vincenzo Romano
Hi all. I'd like to convert an 8-bytes BYTEA into a BIGINT and possibly vice versa. Is there any way to do it? -- Vincenzo Romano NotOrAnd Information Technologies NON QVIETIS MARIBVS NAVTA PERITVS -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your su