@@ -218,3 +218,54 @@ INSERT INTO classes (name, specialization) VALUES
218218(' druid' , ' {"role": "hybrid", "weapon": "staff", "abilities": ["shapeshift", "moonfire", "regrowth"]}' ),
219219(' mage' , ' {"role": "ranged", "weapon": "wand", "abilities": ["fireball", "frostbolt", "arcane blast"]}' ),
220220(' warlock' , ' {"role": "ranged", "weapon": "dagger", "abilities": ["summon demon", "shadowbolt", "curse of agony"]}' );
221+
222+ -- JSON Test Data Table
223+ -- This table contains various JSON structures for testing JSON operators and functions
224+ CREATE TABLE json_test_data (
225+ id SERIAL PRIMARY KEY ,
226+ name VARCHAR (100 ) NOT NULL ,
227+ data JSONB NOT NULL ,
228+ metadata JSON,
229+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
230+ );
231+
232+ INSERT INTO json_test_data (name, data, metadata) VALUES
233+ -- Simple object
234+ (' user_profile' ,
235+ ' {"userId": 1, "username": "john_doe", "email": "john@example.com", "age": 30, "active": true}' ,
236+ ' {"source": "api", "version": "1.0"}' ),
237+
238+ -- Nested object with address
239+ (' user_with_address' ,
240+ ' {"userId": 2, "username": "jane_smith", "email": "jane@example.com", "address": {"street": "123 Main St", "city": "Springfield", "state": "IL", "zipCode": "62701", "country": "USA"}}' ,
241+ ' {"source": "import", "version": "1.0"}' ),
242+
243+ -- Array of items
244+ (' shopping_cart' ,
245+ ' {"cartId": 101, "items": [{"productId": 1, "name": "Laptop", "quantity": 1, "price": 999.99}, {"productId": 2, "name": "Mouse", "quantity": 2, "price": 25.50}], "totalPrice": 1050.99}' ,
246+ ' {"source": "web", "version": "2.0"}' ),
247+
248+ -- Array of strings
249+ (' tags' ,
250+ ' {"postId": 42, "title": "PostgreSQL JSON Functions", "tags": ["database", "postgresql", "json", "tutorial"], "published": true}' ,
251+ ' {"source": "cms", "version": "1.0"}' ),
252+
253+ -- Nested arrays and objects
254+ (' game_stats' ,
255+ ' {"playerId": 123, "stats": {"level": 50, "experience": 125000, "inventory": [{"slot": 1, "item": "Sword of Fire", "rarity": "legendary"}, {"slot": 2, "item": "Shield of Light", "rarity": "epic"}], "achievements": ["First Kill", "Level 50", "Legendary Item"]}}' ,
256+ ' {"source": "game_server", "version": "3.0"}' ),
257+
258+ -- Deep nesting
259+ (' nested_config' ,
260+ ' {"app": {"name": "MyApp", "version": "1.0.0", "settings": {"database": {"host": "localhost", "port": 5432, "credentials": {"username": "admin", "encrypted": true}}, "features": {"darkMode": true, "notifications": {"email": true, "push": false}}}}}' ,
261+ ' {"source": "config", "version": "1.0"}' ),
262+
263+ -- Array of objects with nulls
264+ (' product_reviews' ,
265+ ' {"productId": 456, "reviews": [{"reviewId": 1, "rating": 5, "comment": "Excellent product!", "reviewer": "Alice"}, {"reviewId": 2, "rating": 4, "comment": null, "reviewer": "Bob"}, {"reviewId": 3, "rating": 3, "comment": "Average", "reviewer": null}]}' ,
266+ ' {"source": "reviews", "version": "1.0"}' ),
267+
268+ -- Mixed types
269+ (' analytics' ,
270+ ' {"date": "2024-01-15", "metrics": {"visitors": 1500, "pageViews": 4500, "bounceRate": 0.35, "sources": {"organic": 850, "direct": 400, "referral": 250}}}' ,
271+ ' {"source": "analytics", "version": "1.0"}' );
0 commit comments