CREATE EXTENSION pg_image;

CREATE TEMPORARY TABLE imgtest ( x TEXT, y IMAGE );

-- Insert a PNG.
INSERT INTO imgtest (x, y) VALUES ('malloc-logo.png', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAENElEQVR42u2bbUhTURjH/2tK091N08yWEVS+m1FkkZaZvUgfyjAMLKOVH7KijCwIqaCg/FAZFRQZRCSsEgbG+hJRhGlKaRlpW1pBRG+mrrnNWuiwL71QnNvu3T23nbH7fDzsPjvnf87zPL9zzr2qleu2jCKEbQxC3BQBFAEUARQBFAFC2cL8eWj2zHTkzs9CRkoiOE4LvY4LSOedLjfc7iE8636JptZ2dHRaRftQiQGhKQkG7NyyEalJ05icTVvPK5y5UIe37z/SD4EZaUk4dngfs4MHgLTk6Th+eB8yUpPoCpBgiMf+yu3QRkYwH9OcNhL7K7fBEB9HT4DKbZvBaSODJrHpOC12lW+iI8CsGWlITpwadNk9IzURM9NTpFeB3OwsYvvIiBcmswWNLQ/R128PyCDjxscgL2ceSosLERamJvb9qbVbmgB8CcVktsBsuRnQWe7rt//qg7GkiND3ZOkhEDMuith+514rM8udry+xMdHSQyBCoyG2f3YM+g1OpeV7yKuqtsYvsOHrS2SERh4SlAuc9DoOeh2HSYZ4LF+8wC+wYWYvQAOc/AEbJgSgCU5iwYYJAWiDkxiwCbgAcoGTULAJuAD/AqfL1xpQVlHF+2xZRRUuX2vAyIhXlO//fh4gFzjRAJuArwAa4CQFbAIuAA1wkgI2zHBAsJhyKErDiVqtRmlxIfJy5vJumcVaWUUVcat78XQ1GlvaYDJb4PV62RCgtLgQa1evoLpl5qsIE+Jif/zXKOrqr7MRAksXZcu2ZebzsXRRDjs5QKUit4+OSn/1QBUMSfB2I3mWluVJn6UlvKurhZ0kaDJbAAAF+QsQpdf9kRsA4NbdZjhdblE+9ToOBfkLf/n4aYNOF27dvQ+T+QY7Ani9XtTVN6CuvgE3rtT+dh6mhrGkCMaSIqxaXy5O1NoaYvuGrXsVDlAEYFkAj+cbsT06Si98QxVN3lB9+ephX4CBzw7JFYEv8w/YHeyfBzx7/gIJhngiLfqqCHyZ/7fvHvZXQFNrO1npHxWBL7v/zPzGkiLiNde/fDMlwJMuG5502ah39PFTq897PmaqwPlLV+Ee+kLNn8s9hPOXrgRPGXz3oRdHT56Dyz0k2ZfT5caRmnP40NsXXBzQZXuB3QeqJYVDR6cVlQeqYe1+yfaBCJ/1furHwepTmJ2ZjtzsLGSmpyCW59AUAIaHhzFgd6DT1oN7LW2y5BLRAng836DRjCWCjWPQKXgmhdz0rjHu8GsQUsDJZwjQABu5TQo4+VwBUsBGbqMBTj4FaGptR0H+Ql6wId3gsGJCwMlnCMgFNnKbUHASVAZpg43cJgacBAlAE2zkNrHgpE7OnHNIyA8/9dvR/OARpkyehIkT4pgcfEenFUdOnMXrN+8EP6Py57O5v8EmPDw8IAOmAU4q5bvBEDdFAEUARQBFAEWAULbvZJbCev0cOTsAAAAASUVORK5CYII='::image);

-- Insert the same PNG, but using the BYTEA input format.
INSERT INTO imgtest (x, y) VALUES ('malloc-logo.png (bytea)', image('\x89504e470d0a1a0a0000000d4948445200000040000000400806000000aa6971de00000006624b474400ff00ff00ffa0bda793000000097048597300000b1300000b1301009a9c18000004344944415478daed9b6d48535118c7ff6b4ad3dd4dd3cc961154be9b5164919699bd481fca300c2ca3951fb2a28c2c08a9a0a0fc50191514194424ac1206c6fa125184694a6919695b5a41446fa6aeb9cd5ae8b02fbd509cdbeedd3db79db1fb7c3cec3e3be77fcef33cbf73cebdaa95ebb68c22846d0c42dc1401140114011401140142d9c2fc7968f6cc74e4cecf42464a22384e0bbd8e0b48e79d2e37dcee213ceb7e89a6d67674745a45fb508901a1290906ecdcb211a949d3989c4d5bcf2b9cb95087b7ef3fd20f811969493876781fb3830780b4e4e9387e781f325293e80a906088c7fecaedd04646301fd39c3612fb2bb7c1101f474f80ca6d9bc169238326b1e9382d76956fa223c0ac1969484e9c1a74d93d23351133d353a45781dcec2c62fbc8881726b3058d2d0fd1d76f0fc820e3c6c7202f671e4a8b0b1116a626f6fda9b55b9a007c09c564b6c06cb919d059eeebb7ffea83b1a488d0f764e92110332e8ad87ee75e2b33cb9daf2fb131d1d2432042a321b67f760cfa0d4ea5e57bc8abaab6c62fb0e1eb4b6484461e12940b9cf43a0e7a1d874986782c5fbcc02fb061662f40039cfc011b2604a0094e62c186090168839318b009b80072819350b009b800ff02a7cbd71a505651c5fb6c5945152e5f6bc0c8885794efff7e1e201738d1009b80af001ae024056c022e000d70920236cc7040b09872284ac3895aad46697121f272e6f26e99c55a59451571ab7bf174351a5bda60325be0f57ad910a0b4b8106b57afa0ba65e6ab0813e2627ffcd728eaeaafb311024b1765cbb665e6f3b174510e3b3940a522b78f8e4a7ff540150c49f07623799696e5499fa525bcabab859d2468325b000005f90b10a5d7fd911b00e0d6dd66385d6e513ef53a0e05f90b7ff9f869834e176eddbd0f93f9063b0278bd5ed4d537a0aebe0137aed4fe761ea686b1a408c69222ac5a5f2e4ed4da1a62fb86ad7b150e50046059008fe71bb13d3a4a2f7c43154dde507df9ea615f8081cf0ec915812ff30fd81dec9f073c7bfe02098678222dfaaa087c99ffb7ef1ef65740536b3b59e91f15812fbbffccfcc69222e235d7bf7c3325c0932e1b9e74d9a877f4f153abcf7b3e66aac0f94b57e11efa42cd9fcb3d84f397ae044f197cf7a117474f9e83cb3d24d997d3e5c6919a73f8d0db175c1cd0657b81dd07aa25854347a7159507aa61ed7ec9f681089ff57eeac7c1ea53989d998edcec2c64a6a72096e7d01400868787316077a0d3d6837b2d6db2e412d102783cdfa0d18c25828d63d029782685dcf4ae31eef06b1052c0c96708d0001bb94d0a38f95c0152c0466ea3014e3e05686a6d4741fe425eb021dde0b06242c0c96708c80536729b507012540669838ddc26069c040940136ce436b1e0a44ece9c7348c80f3ff5dbd1fce011a64c9e848913e2981c7c47a715474e9cc5eb37ef043fa3f2e7b3b9bfc1263c3c3c2003a6014e2ae5bbc110374500450045004500458050b6ef6496c27afd1c393b0000000049454e44ae426082'::bytea, 'image/png'));

-- Insert a JPEG (and test that we can include whitespace/newlines).
INSERT INTO imgtest (x, y) VALUES ('kiwidrew.jpg', 'data:image/jpeg;base64,
    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JKlGGqiusoHNkueOoqPt223+wwWf
    4fNFpsfp3oNciNpC5hkBSvUrS8pKz+qbf24HM48IAc9E1AAwFxUu5h0VyVmTwPzKHZbKAgut
    gBxXv5lX2/2gH643UDR/T7K4bTSMvsNBpO1IIHI/xWAKvc7r3POHmXkKWUJWCpPzAHkY1qXz
    hFwaOSK2R55rX5W0BCEBKUiwAFgB9Ma1c98fJclmMyuRJebaZaSVrWtQSlKR3JJ7DAna6a3a
    m6iUeRRNB65Ssn5VS45HquoldkiJGsBZTcDcNzqz5v2iAQLcEHzAQaZXWCvfKLqRtV+sTQPR
    yvuZXzlm9aamylKno8KK5JLRN/KsoBSlQtykm9iOOcdGUtZNBOpGhSKDRa3Tq4xPjKTJpM5g
    tvlpQKSS04ASLEjcm/fviv3L9P6M8hVdCatDzrrnmJcptiS/GhusU1Mh1dgkb1ILy1KvtCio
    KN8HD01Z30WznCqjmlWj0rJC6M+aZPRKocaC4h8G6mCWlKJUk8qSTcXF7XGL1VOImZmg/HYf
    TdTDJmdYkKvrrO6RP+2+sx8z5QlKmZOrK1+E2s/tqe4CkFCv5kedNlD63A7nr6DM55qYz1W8
    oU7xp9Efpqqg/TozCn3zIQUhC2UJNxdO8KPINkA24Ist1u00TqppvmTKUVxuPUqtSJFNiylk
    gNeIUq2m3ZKlNo3cdhgCujqkZj0Ri5xiSqYaZm+ZVTSKijwULm0qLGShalIBB3JdXJZ2kApK
    WlKAPlODx13FpHB+rgqupTxg1uxRe0OqqjS/i4/iIcYXZxt1tTbiSO6FoUApJ+hAPIxCn4m+
    ZaZG0CptEddT8XVq7GXHbCuShttxSl29R2H3UMSrUsx0piiRNUM41dqmNfASGq/OWChhz4Vx
    CWZOwC3iLac5CRckoQAdiQKvep/qAq3UJqO/mJaXY1BpwMOhwVn9xGB+dQ7eIsgKV/QchIwx
    hhMgLuSVqWcN2UqIB3x74PGPO0+2MFxjYSykHpr6hM5dPed2K5Q50l2iyXEpq9KC7szGhxfa
    eA4m90qFj6XsSMXA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wTEJW00GR
    vP2V6kY6R/EOzfzyTN6/tEafStOaNnzL3iqFGniLLS6vcQ0+LbwbcedDYI+vHrgBHY+5W0p3
    cXxd5n3KcDPGT6rlSqRUSGKhGU34a+xX3QT/AHAYqo1P0BzBlNxys5ahSqnSl38RhptTkmGs
    EhSCgXUtAN7KAJt83bcpbC6xrWcF5t0RaqB8vmt16qEn4qALgA45VRD8vftxh8U3T7OlaZU7
    S8oViShI8yxBcA/UgYjmuzq5SaxLpUhhEZ6K+WXWlgKWhQ4KSQSLg3uO4PF+MdDTtNQ4sjIu
    FkVEgpmB8gNj2SLBaCVgWw5IiLDzcEYTWIyRtKRze2FuO2nYFKF+eRizzdeYNEpwh+yJseMd
    NiVlRV2GOePuQm4NvpjY2SL3FwT3wud0UbL0Ob7RyMbJUQyYa4zq1tlW3asH5SDcf/WMZG1X
    BFj746my2pwJWTdIvycQSrAXSZl7N1VyFUVpo1Sm0qox30TqdOhr2radQoKC/ZV/KlQPB2gk
    e7wk9WHUXOqSqxO1He/MFhDankQIgICSbEfsuO/+g9hZqVKHFmrCZDF9rZG8DlNyO36DHdkr
    Sh/OtfYokSvR4jjiVOBMlRT4wHJQghJ81rn7A8HtikgitnkA+YupY15OViRa/qFnzNlPTRs0
    ZxrFVgpeVIEeXMW62HFG6lbSbcnk+5N8JFKgTq1WIuXqREclTpjqWm220323PzKPokdyfbBU
    UDpByjHtIzVXKhLCVJIYivBtCrd9ytoVY+wt2PPPE05ayTlLJcRTOWMvRKckiylNN+dd/wCZ
    ZupX9TjPlxWGMWiF/sFoRYXLIbyG35UWaE9PkfICm835q2ya6pSvAG07IjZukBIPZRSSSe/N
    uLG536EUb8uyKmpuJs7WZLs0k+qLhDdvoUISr+7EFtQnqkGKbDG6VNebisEjhLjiglJP0BNz
    9AcFdTIESk06LSoDeyNCZRHZT/KhCQlI/QDGDNO+dxfIdVovY2GMRMC6rknEF6nafPUSqycx
    QIwcp0txTrgQP3DijdV7dgTcg/W33nMc84i3qT18y508aay851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rWBx0myw7L//2Q=='::image);

-- Test accessor methods
SELECT x, width(y), height(y), filesize(y), mimetype(y), md5(imagedata(y)) FROM imgtest ORDER BY x;

-- Assert that the two PNG files (one as data: URI and one as BYTEA) are identical.
SELECT imagedata((SELECT y FROM imgtest WHERE x = 'malloc-logo.png')) =
       imagedata((SELECT y FROM imgtest WHERE x = 'malloc-logo.png (bytea)'))
    AS "data: URI and BYTEA formats produce identical IMAGE values";

-- Test re-encoding to data: URI
SELECT x, y::text FROM imgtest ORDER BY x;

