Re: Learning Plpgsql ??
От | Steve_Miller@sil.org |
---|---|
Тема | Re: Learning Plpgsql ?? |
Дата | |
Msg-id | OFE0057D9E.976D1929-ON86256CBC.0061F01D@sil.org обсуждение исходный текст |
Ответ на | Learning Plpgsql ?? (Jonathon Batson <jonathon@octahedron.com.au>) |
Список | pgsql-novice |
I took this code from a different message: >CREATE or REPLACE FUNCTION up_seq() RETURNS text AS ' > DECLARE > row RECORD; qrystr TEXT; > BEGIN > -- select sequence information from seq table > [ sequence_name, table_name, pk_column] > FOR row IN SELECT * FROM swim_seq_temp LOOP > > qrystr := > ''SELECT setval('' > || quote_literal(row.sequence_name) > || '', ( SELECT max('' > || quote_ident(row.pk_column) > || '') FROM '' > || quote_ident(row.table_name) > || ''))''; > EXECUTE qrystr; > > END LOOP; > RETURN ''done''; > END; >' LANGUAGE 'plpgsql'; I'm heartened that we have the capabilities to execute dynamic a string like this. However, in SQL Server, this sort of operation slows down the database, because it has to produce a new execution plan. Is the same true for Postgresql? The way SQL Server gets some time back is by the use of sp_executesql. Is there some equivalent in Postgresql? Steve
В списке pgsql-novice по дате отправления: