[SQL] How to describe a field in the table ???
Hi, Im porting my programs from mySQL to PG. mySQL supports a query "DESCRIBE tablename fieldname" , that provides a detailed description of a specific table field. Is there such an equivalent in PG? "\d tablename" gives description for all the fields in the table, however I need to find out a description for a specific field only. Regards, Boulat ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[SQL] Two way encryption in PG???
Hi, Im porting my software from mySQL to PG. I need to encypt a field in a table using two way encription. In mySQL for those purposes I was using build-in functions ENCODE/DECODE, is there such an equivalent in PG? How do I encrypt/decrypt something in PG? Regards, Boulat ---(end of broadcast)--- TIP 3: 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
Re: [SQL] Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT
I've found the discussion to which you have referred: http://www.postgresql.org/mhonarc/pgsql-sql/2001-02/msg00157.html but was unable to find the documentation for the EXECUTE command. From the discussion it seemed to me that doing an "INSERT" into a table of variable name cannot be done now. It is unfortunate, but I guess nothing can be done about it now. At 04:40 PM 3/4/2001 -0800, you wrote: >Mr. Gutierrez: > > The EXECUTE command is what you need. Please see the development >documentation, and the list archives for January-Early Feb. > > -Josh Berkus ---(end of broadcast)--- TIP 3: 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] Re: From mailing list: PL/PGSQL returning recordset
Gerald,
> I was searching for a way to return a recordset from PL/PGSQL (to implement
> Dijkstra's algorithm) when I came upon your post at:
> You mentioned that you posted a "workaround", but I've been unable to find
> it with much searching. I may not be looking in the right place. Can you
> please refer me to the correct place, or send me the post if you have it handy?
Here's the method we're using for all of our searches in our current
application. Pardon my not supplying full SQL declarations; if I had
to, I'd never write this e-mail.
1. Assume that you have a table "staff" with primary key staff_id.
2. Create a second table, "searches" with two columns: search_key and
ref_id, both NOT NULL and INT4, and unique in combination.
3. Create a sequence search_sq.
4. Write a function to search the staff table (and related sub-tables)
based on 6 different criteria (name matching, staff role, SSN, etc.)
singly or in combination.
5. The above function will, after searching the staff table, insert the
appropriate staff_id's into the searches table together with a unique
search_key obtained through NEXTVAL('search_sq'). After the insert, the
function will return the search_key as its result (with 0 indicating
error/no records).
6. You may then display records from the staff table based on linking it
with the searches table, without fear that two user's searches will get
mixed up. Futher, in a low-transaction situation, the searches table
may be used for all searches in the DB on tables with INT4 primary keys.
-Josh Berkus
--
__AGLIO DATABASE SOLUTIONS___
Josh Berkus
Complete information technology [EMAIL PROTECTED]
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
---(end of broadcast)---
TIP 3: 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
Re: [SQL] Two way encryption in PG???
On Sun, 4 Mar 2001, Boulat Khakimov wrote: ->How do I encrypt/decrypt something in PG? Perhaps it'd be better to one-way encrypt something? Granted I don't know the details of your project, but allowing a way to "decrypt" something is rather insecure. -- Dave ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
[SQL] Re: Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT
Gerald Gutierrez wrote: > > I'd like to generalize my function. As per Richard Huxton's suggestion to > create tables named after session ID (thanks Richard)s, I'd like to pass in > some table names so that the algorithm can read from and write into tables > that I specify as parameters to the function. Sometihng like: Known limitation - sorry, should have made things clear. > select dijkstra(inputtablename, outputtablename); > > I've tried typing the parameters as TEXT, and then just inserting $1 in the > select (e.g. SELECT * from $1 ...) This doesn't work, nor did a number of > other ways I tried. Basically, I can think of 3 solutions. Bear in mind it's late here, I've had a few drinks with dinner. 1. Use the EXECUTE statement in 7.1 to run the query 2. Use the EXECUTE statement to construct a custom function, one for each session with the table hard-coded (you could also do this from the application I'd guess) 3. Try pl/Tcl - I _think_ that lets you construct a dynamic query, but I don't know TCL so can't say (it's supposed to be easy enough but I've never got round to it). HTH - Richard Huxton ---(end of broadcast)--- TIP 3: 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
