Re: [SQL] crypt function

2000-09-06 Thread Ian Turner

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

> INSERT INTO TABLE users VALUES ('test',crypt('passtest'));

AFAIK there is no builtin crypt function.

If you want one, use PL/perl to call the perl crypt function.

Ian Turner
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5tytdfn9ub9ZE1xoRAtxUAJ41TmWz/sloQbVXoUeVniGs5TW71gCfTctK
Ow32lDg7IL9Fqr8SFCzT5gs=
=YCUp
-END PGP SIGNATURE-




[SQL] Re: [GENERAL] function

2000-09-05 Thread Ian Turner

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

> how can I write function which takes text from one field, replaces
> some characters and puts it in other field? I have array with old and
> new values.

Probably best to do this as an embedded perl sql function. Then it is
about 3 lines.

Ian
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5rbnTfn9ub9ZE1xoRAh7uAKCAxqAM9Wo09g6qntF6qJTtp5u+KACgsO9d
VvH5BBpn4gIpdrHFAw8x6Jo=
=zH55
-END PGP SIGNATURE-




Re: [SQL] work on some tables in the same time.

2000-09-13 Thread Ian Turner

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

> I want to execute this query on some table2 in the same time :
> 
> INSERT INTO table2_n(f1, f2, f3)
>   SELECT DISTINCT f1, f2, f3 FROM table1_n ;

One way would be to do:
BEGIN
CREATE VIEW tableselecttemp AS
SELECT DISTINCT f1, f2, f3 FROM table1_n;
INSERT INTO table2_n(f1, f2, f3) SELECT * FROM tableselecttemp;
INSERT INTO table2  (f1, f2, f3) SELECT * FROM tableselecttemp;
DROP VIEW tableselecttemp;
ROLLBACK;

Alternatively, run the select query twice without the temporary
view. You'll have to try it both ways, on a realistic data set, to see
which is faster for you.

Ian
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5v6HGfn9ub9ZE1xoRAuo0AJwNCXhjE4WWH0WMeZrLZCjrR/H37ACZAR4N
FkuWQ4rEUUMI6bCcZkCU3XA=
=q6gb
-END PGP SIGNATURE-




Re: [SQL] work on some tables in the same time.

2000-09-13 Thread Ian Turner

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

> testdb=#CREATE VIEW tableselecttemp AS SELECT DISTINCT f1, f2, f3 FROM
> table1_n;
> ERROR:  DISTINCT not supported in views

In that case, you'll have to create a temporary table instead. This may
actually be faster, because you only have to search table1_n once.

Ian
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5v6gBfn9ub9ZE1xoRAh1GAKC7SvP2orhC9lZsC0BJaqntXGlmOQCfTwj4
/Qmr4PIfcE7Ue9UEZAWGhrM=
=VV5w
-END PGP SIGNATURE-