Mass fix for outdated links to PostgreSQL development docs

1

Please login or register to vote for this query.

(click on this box to dismiss)

Queries for SELECT and UPDATE

Stack Overflow

Q&A for professional and enthusiast programmers

-- Mass fix for outdated links to PostgreSQL development docs
-- Queries for SELECT and UPDATE

-- Show **one** selected case (full query is slow)
SELECT Id AS [Post Link]
      ,Body
      ,replace(Body
             ,'http://developer.postgresql.org/pgdocs/postgres/'
             ,'http://www.postgresql.org/docs/devel/static/') AS FixedBody
-- or proper:,'http://www.postgresql.org/docs/current/interactive/')
FROM   Posts
WHERE  Id = 1370570  -- pre-selected case
AND    Body LIKE '%developer.postgresql.org/pgdocs/%'

/*
-- show all
SELECT Id AS [Post Link], Body
FROM   Posts
WHERE  Body LIKE '%developer.postgresql.org/pgdocs/%'

SELECT PostId AS [Post Link], Text
FROM   Comments
WHERE  Text LIKE '%developer.postgresql.org/pgdocs/%'

-- fix all
UPDATE Posts
SET    Body = replace(Body
                  ,'http://developer.postgresql.org/pgdocs/postgres/'
                  ,'http://www.postgresql.org/docs/devel/static/')
-- or proper:     ,'http://www.postgresql.org/docs/current/interactive/')
WHERE  Body LIKE '%http://developer.postgresql.org/pgdocs/postgres/%'

UPDATE Comments
SET    Text = replace(Text
                  ,'http://developer.postgresql.org/pgdocs/postgres/'
                  ,'http://www.postgresql.org/docs/devel/static/')
-- or proper:     ,'http://www.postgresql.org/docs/current/interactive/')
WHERE  Text LIKE '%http://developer.postgresql.org/pgdocs/postgres/%'
*/

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results