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